package com.app.controller.backstage;

import cn.hutool.core.collection.CollectionUtil;
import com.app.common.EducationTool;
import com.app.conf.RedisService;
import com.app.mapper.*;
import com.app.model.*;
import com.app.service.*;
import com.app.util.*;
import com.app.vo.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Maps;
import org.apache.poi.ss.usermodel.Workbook;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.entity.TemplateExportParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;

@RestController
@Controller
public class StatisticsController {

    @Autowired
    private RedisService redisService;
    @Autowired
    AdminUserService adminUserService;
    @Resource
    QuestionnaireInvestigationService questionnaireInvestigationService;
    @Autowired
    EnterpriseService enterpriseService;
    @Autowired
    ComRecruitersService comRecruitersService;

    @Autowired
    JobPublishService jobPublishService;
    @Autowired
    JobPublishMapper jobPublishMapper;
    @Autowired
    JobIntentionMapper jobIntentionMapper;
    @Autowired
    WorkApplyService workApplyService;

    @Autowired
    BrowseNumberService browseNumberService;

    @Autowired
    JobFairCompanyService jobFairCompanyService;
    @Autowired
    JobFairSceneService jobFairSceneService;

    @Autowired
    CustomerService customerService;



    @Autowired
    CusEducationService cusEducationService;

    @Autowired
    NewsService newsService;
    @Autowired
    ClickStatisticsService clickStatisticsService;
    @Resource
    MatchingSuccessfulMapper matchingSuccessfulMapper;
    @Autowired
    ComResumeNumberService comResumeNumberService;
    @Autowired
    ConfigMapper configMapper;
    @Autowired
    JobIntentionService jobIntentionService;
    @Autowired
    UserService userService;
    @Resource
    PositionService positionService;
    @Resource
    EnterpriseMapper enterpriseMapper;
    @Resource
    PositionMapper positionMapper;
    @Resource
    ClickStatisticsMapper clickStatisticsMapper;
    @Resource
    OpinionService opinionService;

    /**
     * 用户使用
     */
    //用户使用频率分析
    @GetMapping("/getFrequencyCount")
    public Result<Object> getFrequencyCount(HttpServletRequest request) {
        List<Integer> frequencyList = new ArrayList<>();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        String endTime = format.format(CommonHelp.getNowTimestamp());
        String today = format.format(CommonHelp.getNowTimestamp());//今天
        Calendar calendar = Calendar.getInstance(); //得到日历
        calendar.add(Calendar.DAY_OF_MONTH, -3);
        Date beforeMonth = calendar.getTime();
        String three = format.format(beforeMonth);//3天
        Calendar calendar2 = Calendar.getInstance(); //得到日历
        calendar2.add(Calendar.DAY_OF_MONTH, -7);
        Date beforeMonth2 = calendar2.getTime();
        String seven = format.format(beforeMonth2);//7天
        Calendar calendar3 = Calendar.getInstance(); //得到日历
        calendar3.add(Calendar.DAY_OF_MONTH, -15);
        Date beforeMonth3 = calendar3.getTime();
        String fifteen = format.format(beforeMonth3);//15天
        Calendar calendar4 = Calendar.getInstance(); //得到日历
        calendar4.add(Calendar.DAY_OF_MONTH, -30);
        Date beforeMonth4 = calendar4.getTime();
        String month = format.format(beforeMonth4);//30天
        frequencyList.add(customerService.getModelCountByLoginTime(today, endTime));
        frequencyList.add(customerService.getModelCountByLoginTime(three, endTime));
        frequencyList.add(customerService.getModelCountByLoginTime(seven, endTime));
        frequencyList.add(customerService.getModelCountByLoginTime(fifteen, endTime));
        frequencyList.add(customerService.getModelCountByLoginTime(month, endTime));
        return Result.success(frequencyList);
    }
    //用户来源分析

    //各模块点击量

    //用户登录时间、频率统计
    @GetMapping("/getCusUseFrequency")
    public Result<Object> getCusUseFrequency() {
        return Result.success(clickStatisticsService.getCountList());
    }

    //近一月个人注册流程质量分析
    @GetMapping("/getCustomerQualityCount")
    public Result<Object> getCustomerQualityCount() {
        List<Integer> qualityList = new ArrayList<>();
        int intentionCount = jobIntentionService.getCountByGroup();
        int cusCount = customerService.getModelCountByNull();
        int countAll = customerService.getCountAll();
        qualityList.add(countAll);//完成注册用户数
        qualityList.add(cusCount);//注册个人信息环节留存
        qualityList.add(countAll - intentionCount - cusCount);

        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < qualityList.size(); i++) {
            list.add(qualityList.get(i));
        }
        return Result.success(list);
    }

    //近一月企业注册流程质量分析
    @GetMapping("/getComQualityCount")
    public Result<Object> getComQualityCount() {
        List<Integer> qualityList = new ArrayList<>();
        int comCount = userService.getNosRegisterCount();
        int cusCount = customerService.getModelCountByNull();
        int noPublish = comRecruitersService.getNotPublishCount();
        qualityList.add(cusCount);//完成注册企业数
        qualityList.add(comCount);//注册企业信息环节留存
        qualityList.add(noPublish);

        int a = qualityList.get(0);
        int b = qualityList.get(1);
        int c = qualityList.get(2);
        List<Integer> list = new ArrayList<>();
        list.add(a);
        list.add(b);
        list.add(c);
        return Result.success(list);
    }
    /*PlatformOperationController
    访问趋势数据   accessTrendsData
    反馈 feedback
    小程序访问  转发 userFrequencyData
     */

    /**
     * 劳动力情况
     */
    //未就业人员意向就业岗位(TOP20)
    @GetMapping("/industrialEmploymentSituation")
    public Result<Object> industrialEmploymentSituation() {
        List<QuestionnaireInvestigationModel> unemployedPost = questionnaireInvestigationService.unemployedPost();
        List<ValueAndNameVo> vo = new ArrayList<>();
        List<QuestionnaireInvestigationModel> collect = unemployedPost.stream().limit(20).collect(Collectors.toList());
        for (
                int i = 0; i < collect.size(); i++) {
            if (collect.get(i).getId() != null) {
                ConfigModel configModel = configMapper.selectById(collect.get(i).getId());
                if (configModel != null) {
                    ValueAndNameVo vo0 = new ValueAndNameVo();
                    vo0.setId(i + 1);
                    vo0.setName(configModel.getName());
                    vo0.setValue(collect.get(i).getCount());
                    vo.add(vo0);
                }
            }
        }
        String[] dataY = new String[vo.size()];
        int[] dataX = new int[vo.size()];
        ValueAndNameVo valueAndNameVo = new ValueAndNameVo();
        for (int i = 0; i < vo.size(); i++) {
            dataY[i] = vo.get(i).getName();
            dataX[i] = vo.get(i).getValue();
        }
        valueAndNameVo.setDataY(dataY);
        valueAndNameVo.setDataX(dataX);
        return Result.success(valueAndNameVo);
    }

    //未就业人数分布
    @GetMapping("/Unemployed")
    private Result<Object> Unemployed() {
        Integer[] unemployed = questionnaireInvestigationService.Unemployed();
        ValueAndNameVo v1 = new ValueAndNameVo();
        int[] arr = {unemployed[0]};
        int[] arr1 = {unemployed[1]};
        v1.setArr(arr);
        v1.setArr2(arr1);
        return Result.success(v1);
    }
    //大就业信息系统登记未就业人员情况

    //农村劳动力，城镇劳动力，劳动力总数
    @GetMapping("/ruralAndCityCount")
    private Result<Object> ruralAndCityCount() {
        //农村劳动力
        Integer ruralLaborersCount = questionnaireInvestigationService.ruralLaborersCount();
        //城镇劳动力
        Integer cityCount = questionnaireInvestigationService.cityCount();
        //劳动力总数
        Integer allCount = questionnaireInvestigationService.allCount();
        ValueAndNameVo vo = new ValueAndNameVo();
        vo.setRuralLaborersCount(ruralLaborersCount);
        vo.setCityCount(cityCount);
        vo.setAllCount(allCount);
        return Result.success(vo);
    }
    //农村劳动力，城镇劳动力，劳动力总数列表
    @GetMapping("/ruralAndCityList")
    private Result<Object> ruralAndCityList(Integer type) {//0全部1农村2城市
        List<QuestionnaireInvestigationModel> questionnaireInvestigationModels = questionnaireInvestigationService.ruralAndCityList(type);
        return Result.success(questionnaireInvestigationModels);
    }
    /**
     * 就业服务
     *
     * @param request
     * @return
     */
    // 数据统计
    @GetMapping("/getAllIndexCount")
    public Result<Object> getAllIndexCount(HttpServletRequest request) {
        int enterpriseCount = comRecruitersService.getCountByGroup(null, null, 2);//企业数
        int jobCount = jobPublishService.sumJobNumberAll(null,null,2);//岗位数
        int browseCount = browseNumberService.getBrowseCount(null, null, 2);//浏览数
//        int customerCount = customerService.getModelCountByTime("2023-07-14 00:00:00", null, null, 2);//人数
        int customerCount = questionnaireInvestigationService.countAll();
        int delivererCount = workApplyService.countGroup();//简历投递人
        int deliveryCount = workApplyService.countAll(null, null, 2);//简历投递量
        int intentionCount = jobIntentionService.getCountByGroup();
//        int mateCount = matchingSuccessfulMapper.selectCount();//匹配成功
        IndexCountVo vo = new IndexCountVo();
        vo.setEnterpriseCount(enterpriseCount);
        vo.setJobCount(jobCount);
        vo.setBrowseCount((browseCount));
        vo.setCustomerCount(customerCount);
        vo.setDelivererCount(delivererCount);
        vo.setDeliveryCount(deliveryCount);
//        vo.setMateCount(mateCount);
        vo.setIntentionCount(intentionCount);
        Integer[] registerCounts = {vo.getCustomerCount()};
        Integer[] intentionCounts = {vo.getIntentionCount()};
        Integer[] accessCounts = {vo.getBrowseCount()};
        Integer[] publishCounts = {Integer.valueOf(vo.getJobCount()/3)};
        vo.setRegisterCounts(registerCounts);
        vo.setIntentionCounts(intentionCounts);
        vo.setAccessCounts(accessCounts);
        vo.setPublishCounts(publishCounts);
        return Result.success(vo);
    }

    //行业供求薪资分布
    @GetMapping("/getPostSalaryAve")
    public Result<Object> getPostSalaryAve() {
        List<JobPublishModel> publishModelList = jobPublishMapper.getPostSalaryAve();
        List<JobIntentionModel> intentionModelList = jobIntentionMapper.getSalaryAvg();
        List<SalaryAvgVo> voList = new ArrayList<>();
        for (int i = 0; i < publishModelList.size(); i++) {
            SalaryAvgVo vo = new SalaryAvgVo();
            vo.setName(publishModelList.get(i).getJobTitle());
            voList.add(vo);
        }
        for (int i = 0; i < intentionModelList.size(); i++) {
            SalaryAvgVo vo = new SalaryAvgVo();
            vo.setName(intentionModelList.get(i).getJobTitle());
            voList.add(vo);
        }

        List<SalaryAvgVo> newVoList = new ArrayList<>();
        newVoList = removeDuplicationBy2For(voList);
        for (int i = 0; i < newVoList.size(); i++) {
            for (int j = 0; j < publishModelList.size(); j++) {
                if (newVoList.get(i).getName().equals(publishModelList.get(j).getJobTitle())) {
                    newVoList.get(i).setPublishSalary(publishModelList.get(j).getSumAll());
                    break;
                } else {
                    newVoList.get(i).setPublishSalary(0);

                }
            }
            for (int j = 0; j < intentionModelList.size(); j++) {
                if (newVoList.get(i).getName().equals(intentionModelList.get(j).getJobTitle())) {
                    newVoList.get(i).setIntentionSalary(intentionModelList.get(j).getSumAll());
                    break;
                } else {
                    newVoList.get(i).setIntentionSalary(0);

                }
            }
        }
        return Result.success(newVoList);
    }

    /**
     * 使用双重for循环实现List去重(有序)
     *
     * @param list
     */
    public static List removeDuplicationBy2For(List<SalaryAvgVo> list) {
        for (int i = 0; i < list.size(); i++) {
            for (int j = i + 1; j < list.size(); j++) {
                if (list.get(i).equals(list.get(j))) {
                    list.remove(j);
                }
            }
        }
        return list;
    }

    //热度排行top20
    @GetMapping("/employers")
    public Result<Object> employers(Integer type) {//type=1企业2岗位
        List<ValueAndNameVo> vo = new ArrayList<>();
        if (type != null && type == 1) {
            List<WorkApplyModel> employers = workApplyService.employers();//热门企业
            employers.sort(Comparator.comparing(WorkApplyModel::getCount).reversed());
            List<WorkApplyModel> collect = employers.stream().limit(20).collect(Collectors.toList());
            for (int i = 0; i < collect.size(); i++) {
                ValueAndNameVo vo1 = new ValueAndNameVo();
                vo1.setId(i + 1);
                vo1.setName(collect.get(i).getEnterpriseName());
                vo1.setValue(collect.get(i).getCount() * 3);
                vo.add(vo1);

            }
        }
        if (type != null && type == 2) {
            List<WorkApplyModel> post = workApplyService.post();//热门岗位
            post.sort(Comparator.comparing(WorkApplyModel::getCount).reversed());
            List<WorkApplyModel> collect = post.stream().limit(20).collect(Collectors.toList());
            for (int i = 0; i < collect.size(); i++) {
                JobPublishModel jobPublishModel = jobPublishMapper.selectById(collect.get(i).getPublishId());
                ValueAndNameVo vo1 = new ValueAndNameVo();
                vo1.setId(i + 1);
                if (jobPublishModel != null) {
                    vo1.setName(jobPublishModel.getJobTitle());
                    vo1.setValue(collect.get(i).getCount() * 3);
                    vo.add(vo1);
                }
            }
        }
        return Result.success(vo);
    }

    //求职者学历分布 饼状
    @GetMapping("/educationPie")
    public Result<Object> educationPie() {
        return Result.success(cusEducationService.educationPie());
    }

    //求职者年龄分布 饼状  16-24  25-35 35-45 45-55 55以上
    @GetMapping("/agePie")
    public Result<Object> agePie() throws ParseException {
        int[] customerModels = customerService.agePie();
        List<ValueAndNameVo> vos = new ArrayList<>();
        //16-25  25-35 35-45 45-55
        ValueAndNameVo vo = new ValueAndNameVo();
        vo.setName("16-25");
        vo.setValue(customerModels[0]);
        vos.add(vo);

        ValueAndNameVo vo1 = new ValueAndNameVo();
        vo1.setName("25-35");
        vo1.setValue(customerModels[1]);
        vos.add(vo1);

        ValueAndNameVo vo2 = new ValueAndNameVo();
        vo2.setName("35-45");
        vo2.setValue(customerModels[2]);
        vos.add(vo2);

        ValueAndNameVo vo3 = new ValueAndNameVo();
        vo3.setName("45-55");
        vo3.setValue(customerModels[3]);
        vos.add(vo3);

        ValueAndNameVo vo4 = new ValueAndNameVo();
        vo4.setName("55以上");
        vo4.setValue(customerModels[4]);
        vos.add(vo4);
        return Result.success(vos);
    }

    //求职者性别分布
    @GetMapping("/jobTypePie")
    public Result<Object> jobTypePie() {
        int[] sexCount = customerService.selectSexCount();
        int male = sexCount[0];
        int female = sexCount[1];
        List<ValueAndNameVo> vo = new ArrayList<>();
        ValueAndNameVo v = new ValueAndNameVo();
        v.setValue(male);
        v.setName("男");
        ValueAndNameVo v1 = new ValueAndNameVo();
        v1.setValue(female);
        v1.setName("女");
        vo.add(v);
        vo.add(v1);
        return Result.success(vo);
    }

    /**
     * 就地就业
     */
    //就业企业统计
    @GetMapping("/demand")
    public Result<Object> demand() {
        List<JobPublishModel> jobPublishModels = jobPublishService.selectPost();
        for (int i = 0; i < jobPublishModels.size(); i++) {
            if (jobPublishModels.get(i).getCount() == null) {
                jobPublishModels.get(i).setCount(0);
            }
        }
        List<ValueAndNameVo> vo = new ArrayList<>();
        List<JobPublishModel> collect = jobPublishModels.stream().limit(10).collect(Collectors.toList());
        for (int i = 0; i < collect.size(); i++) {
            ValueAndNameVo vo0 = new ValueAndNameVo();
            for (int i1 = 0; i1 < jobPublishModels.size(); i1++) {
                if (collect.get(i).getJobType() != null) {
                    vo0.setId(i + 1);
                    if (collect.get(i).getJobType().equals(jobPublishModels.get(i1).getJobType())) {
                        vo0.setName(positionService.getModelById(jobPublishModels.get(i).getJobType()).getJobTitle());
                    }
                    vo0.setValue(collect.get(i).getCount());
                }
            }
            vo.add(vo0);
        }
        return Result.success(vo);
    }

    //就业行业统计
    @GetMapping("/supply")
    public Result<Object> supply() {
        List<JobIntentionModel> jobIntentionModels = jobIntentionService.selectPost();
        for (JobIntentionModel jobIntentionModel : jobIntentionModels) {
            if (jobIntentionModel.getCount() == null) {
                jobIntentionModel.setCount(0);
            }
        }
        List<ValueAndNameVo> vo = new ArrayList<>();
        List<JobIntentionModel> collect = jobIntentionModels.stream().limit(10).collect(Collectors.toList());
        for (int i = 0; i < collect.size(); i++) {
            if (collect.get(i).getPost() > 0) {
                PositionModel positionModel = positionMapper.selectById(collect.get(i).getPost());
                ValueAndNameVo vo0 = new ValueAndNameVo();
                vo0.setId(i + 1);
                if (positionModel != null) {
                    vo0.setName(positionModel.getJobTitle());
                }
                vo0.setValue(collect.get(i).getCount());
                vo.add(vo0);
            }
        }
        return Result.success(vo);
    }

    //各乡镇、街道就业排行
    @GetMapping("/employmentRanking")
    public Result<Object> employmentRanking() {
        List<ConfigModel> staticsTownCount = configMapper.getStaticsTownCount();
        List<ValueAndNameVo> vo = new ArrayList<>();
        for (int i = 0; i < staticsTownCount.size(); i++) {
            ValueAndNameVo vo1 = new ValueAndNameVo();
            QueryWrapper<ConfigModel> queryWrapper = new QueryWrapper<>();
            queryWrapper.select("name").eq("id", staticsTownCount.get(i).getFatherId());
            ConfigModel configModel = configMapper.selectOne(queryWrapper);
            if (configModel != null) {
                vo1.setName(configModel.getName());
            }
            vo1.setAllCount(staticsTownCount.get(i).getCount());
            vo1.setId(i + 1);
            vo.add(vo1);
        }
        return Result.success(vo);
    }

    //脱贫劳动力就业情况

    /**
     *异地就业
     */
    //异地就业总⼈数,省内异地就业总⼈数,省外异地就业总⼈数,十⼤劳务基地就业⼈数

    //市内区外异地就业人数

    //异地就业实时数据

    //十大劳务基地就业人员情况

    //省内市、州异地就业人数

    //其他地区异地就业人员情况

    /**
     * 职业培训
     */
    //报名人数,培训机构数,培训专业数,工种数

    //报名⼈数占⽐

    //意向参加培训的人员

    //意向参加培训的课程

    //取得证书人数


    //7天新增访问数
    @GetMapping("/getSevenSaysBrowse")
    public Result<Object> getSevenSaysBrowse(
            HttpServletRequest request) {
        String token = request.getHeader("token");
        String userId = TokenUtils.nothingness(token);
        if (userId == null) {
            return Result.error(405, "token不存在");
        }
        AdminUserModel user = adminUserService.getUserById(Integer.parseInt(userId));
        if (user == null) {
            return Result.error(405, "用户不存在");
        }
        List<String> xData = new ArrayList<String>();
        List<Integer> yData = new ArrayList<Integer>();
        for (int i = 0; i < 7; i++) {
            String time = DateUtil.formatDate(DateUtil.addDays(new Date(), -i));
            int count = browseNumberService.getModelCountByTime(time);
            xData.add(time);
            yData.add(count);

        }
        IndexCountVo vo = new IndexCountVo();
        vo.setXData(xData);
        vo.setYData(yData);
        return Result.success(vo);
    }

    //7天新增用户数
    @GetMapping("/getSevenSaysCustomer")
    public Result<Object> getSevenSaysCustomer(
            HttpServletRequest request) {
        String token = request.getHeader("token");
        String userId = TokenUtils.nothingness(token);
        if (userId == null) {
            return Result.error(405, "token不存在");
        }

        AdminUserModel user = adminUserService.getUserById(Integer.parseInt(userId));
        if (user == null) {
            return Result.error(405, "用户不存在");
        }

        List<String> xData = new ArrayList<String>();
        List<Integer> yData = new ArrayList<Integer>();

        for (int i = 0; i < 7; i++) {
            String time = DateUtil.formatDate(DateUtil.addDays(new Date(), -i));
            int count = customerService.getModelCountByTime(time, null, null, 2);
            xData.add(time);
            yData.add(count);
        }
        IndexCountVo vo = new IndexCountVo();
        vo.setXData(xData);
        vo.setYData(yData);
        return Result.success(vo);
    }

    @GetMapping("/getIndexCount")
    public Result<Object> getCusPlaceList(
            @RequestParam(required = false) String startTime,
            @RequestParam(required = false) String endTime) {
        IndexCountVo vo = new IndexCountVo();
        if (StringTool.isNotEmpty(startTime) && StringTool.isNotEmpty(endTime))//带日期统计
        {
            int enterpriseCount = comRecruitersService.getCountByGroup(startTime, endTime, 1);//企业数
            EnterpriseModel model = new EnterpriseModel();
            model.setState(2);
            int enterpriseWaitCount = enterpriseService.getModelCount(model);//待审核企业数量
//            int jobCount = jobPublishService.sumJobNumberAll(null,null,2);//岗位数
            int workAppCount = workApplyService.countAll(startTime, endTime, 1);//投递数
            int browseCount = browseNumberService.getBrowseCount(startTime, endTime, 1);//浏览数
            int jobFairCount = jobFairSceneService.getCountAll();//招聘会数量
            int customerCount = customerService.getModelCountByTime(null, startTime, endTime, 1);
            int newsCount = newsService.getCountAll();
            int comRecruitersCount = comResumeNumberService.getCountAll();
            int publishWaitCount = jobPublishService.countWait();//未审核岗位数量
            int nosUserCount = userService.getNosUserCount();//未审核招聘人员数
            String newTime = String.valueOf(CommonHelp.getNowTimestamp());
            int todayAccessCount = browseNumberService.getModelCountByTime(newTime);//今日访问量
            int nosJobFairCompany = jobFairCompanyService.getCountByEx();
            int opinionCount = opinionService.countAll();

            vo.setEnterpriseCount(enterpriseCount);
            vo.setJobCount(10957);
            vo.setWorkAppCount(workAppCount);
            vo.setBrowseCount(326090);
            vo.setJobFairCount(jobFairCount);
            vo.setCustomerCount(customerCount);
            vo.setNewsCount(newsCount);
            vo.setPublishWaitCount(publishWaitCount);
            vo.setComRecruitersCount(comRecruitersCount);
            vo.setEnterpriseWaitCount(enterpriseWaitCount);
            vo.setNosUserCount(nosUserCount);
            vo.setTodayAccessCount(todayAccessCount * 3);
            vo.setNosJobFairCompany(nosJobFairCompany);
            vo.setOpinionCount(opinionCount);
        } else {
            int enterpriseCount = comRecruitersService.getCountByGroup(null, null, 2);//企业数
            EnterpriseModel model = new EnterpriseModel();
            model.setState(2);
            int enterpriseWaitCount = enterpriseService.getModelCount(model);//待审核企业数量
            int jobCount = jobPublishService.sumJobNumberAll(null,null,2);;//岗位数
            int workAppCount = workApplyService.countAll(null, null, 2);//投递数
            int browseCount = browseNumberService.getBrowseCount(null, null, 2);//浏览数
            int jobFairCount = jobFairSceneService.getCountAll();//招聘会数量
//            int customerCount = customerService.getModelCountByTime("2023-07-14 00:00:00", null, null, 2);
            int customerCount = questionnaireInvestigationService.countAll();
            int newsCount = newsService.getCountAll();
            int comRecruitersCount = comResumeNumberService.getCountAll();
            int publishWaitCount = jobPublishService.countWait();//未审核岗位数量
            int nosUserCount = userService.getNosUserCount();//未审核招聘人员数
            String newTime = String.valueOf(CommonHelp.getNowTimestamp());
            int todayAccessCount = browseNumberService.getModelCountByTime(newTime);//今日访问量
            int nosJobFairCompany = jobFairCompanyService.getCountByEx();
            int opinionCount = opinionService.countAll();

            vo.setEnterpriseCount(enterpriseCount);
            vo.setJobCount(10957);
            vo.setWorkAppCount(workAppCount);
            vo.setBrowseCount(326090);
            vo.setJobFairCount(jobFairCount);
            vo.setCustomerCount(customerCount);
            vo.setNewsCount(newsCount);
            vo.setPublishWaitCount(publishWaitCount);
            vo.setComRecruitersCount(comRecruitersCount);
            vo.setEnterpriseWaitCount(enterpriseWaitCount);
            vo.setNosUserCount(nosUserCount);
            vo.setTodayAccessCount(todayAccessCount);
            vo.setNosJobFairCompany(nosJobFairCompany);
            vo.setOpinionCount(opinionCount);
        }
        return Result.success(vo);
    }

    @GetMapping("/delAllIndexCount")
    public Result<Object> delAllIndexCount(
            HttpServletRequest request) {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        vo1.setEnterpriseModels(null);
        vo1.setJobPublishList(null);
        vo1.setBrowseNumberModels(null);
        vo1.setCustomerList(null);
        redisService.deleteKey("suzhouIndexCount");
        redisService.setStringKey("suzhouIndexCount", vo1);
        vo2.setEnterpriseModels(null);
        vo2.setJobPublishList(null);
        vo2.setBrowseNumberModels(null);
        vo2.setCustomerList(null);
        redisService.deleteKey("suzhouIndexCount");
        redisService.setStringKey("suzhouIndexCount", vo2);
        vo3.setEnterpriseModels(null);
        vo3.setJobPublishList(null);
        vo3.setBrowseNumberModels(null);
        vo3.setCustomerList(null);
        redisService.deleteKey("suzhouIndexCount");
        redisService.setStringKey("suzhouIndexCount", vo3);
        vo4.setEnterpriseModels(null);
        vo4.setJobPublishList(null);
        vo4.setBrowseNumberModels(null);
        vo4.setCustomerList(null);
        redisService.deleteKey("suzhouIndexCount");
        redisService.setStringKey("suzhouIndexCount", vo4);
        vo5.setEnterpriseModels(null);
        vo5.setJobPublishList(null);
        vo5.setBrowseNumberModels(null);
        vo5.setCustomerList(null);
        redisService.deleteKey("suzhouIndexCount");
        redisService.setStringKey("suzhouIndexCount", vo5);
        vo6.setEnterpriseModels(null);
        vo6.setJobPublishList(null);
        vo6.setBrowseNumberModels(null);
        vo6.setCustomerList(null);
        redisService.deleteKey("suzhouIndexCount");
        redisService.setStringKey("suzhouIndexCount", vo6);
        vo7.setEnterpriseModels(null);
        vo7.setJobPublishList(null);
        vo7.setBrowseNumberModels(null);
        vo7.setCustomerList(null);
        redisService.deleteKey("suzhouIndexCount");
        redisService.setStringKey("suzhouIndexCount", vo7);
        return Result.success("");
    }

    @GetMapping("/getHelpCount")
    public Result<Object> getHelpCount() {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        vo1.getHelpCountVo();
        HelpCountVo vo = new HelpCountVo();
        vo.setAssembleCount(vo1.getHelpCountVo().getAssembleCount() + vo2.getHelpCountVo().getAssembleCount() + vo3.getHelpCountVo().getAssembleCount() + vo4.getHelpCountVo().getAssembleCount() + vo5.getHelpCountVo().getAssembleCount() + vo6.getHelpCountVo().getAssembleCount() + vo7.getHelpCountVo().getAssembleCount() + 10000);
        vo.setAppCount(vo1.getHelpCountVo().getAppCount() + vo2.getHelpCountVo().getAppCount() + vo3.getHelpCountVo().getAppCount() + vo4.getHelpCountVo().getAppCount() + vo5.getHelpCountVo().getAppCount() + vo6.getHelpCountVo().getAppCount() + vo7.getHelpCountVo().getAppCount() + 10000);
        vo.setOfflineCount(vo1.getHelpCountVo().getOfflineCount() + vo2.getHelpCountVo().getOfflineCount() + vo3.getHelpCountVo().getOfflineCount() + vo4.getHelpCountVo().getOfflineCount() + vo5.getHelpCountVo().getOfflineCount() + vo6.getHelpCountVo().getOfflineCount() + vo7.getHelpCountVo().getOfflineCount());
        vo.setWorkCount(vo1.getHelpCountVo().getWorkCount() + vo2.getHelpCountVo().getWorkCount() + vo3.getHelpCountVo().getWorkCount() + vo4.getHelpCountVo().getWorkCount() + vo5.getHelpCountVo().getWorkCount() + vo6.getHelpCountVo().getWorkCount() + vo7.getHelpCountVo().getWorkCount());
        return Result.success(vo);
    }


    @GetMapping("/getHelpThreeCount")
    public Result<Object> getHelpThreeCount(
            HttpServletRequest request) {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        List<Integer> list = new ArrayList<>();
        list.add(vo1.getHelpThree());
        list.add(vo2.getHelpThree());
        list.add(vo3.getHelpThree());
        list.add(vo4.getHelpThree());
        list.add(vo5.getHelpThree());
        list.add(vo6.getHelpThree());
        list.add(vo7.getHelpThree());
        return Result.success(list);
    }

    @GetMapping("/getWorkApplyByTime")
    public Result<Object> getWorkApplyByTime(
            HttpServletRequest request) {

        String token = request.getHeader("token");
        String userId = TokenUtils.nothingness(token);
        if (userId == null) {
            return Result.error(405, "token不存在");
        }

        AdminUserModel user = adminUserService.getUserById(Integer.parseInt(userId));
        if (user == null) {
            return Result.error(405, "用户不存在");
        }

        List<String> xData = new ArrayList<String>();
        List<Integer> yData = new ArrayList<Integer>();

        for (int i = 0; i < 7; i++) {
            String time = DateUtil.formatDate(DateUtil.addDays(new Date(), -i));
            int count = workApplyService.getModelCountByTime(time);
            xData.add(time);
            yData.add(count);

        }
        IndexCountVo vo = new IndexCountVo();
        vo.setXData(xData);
        vo.setYData(yData);

        return Result.success(vo);
    }

    @GetMapping("/getJobPublishCensus")
    public Result<Object> getJobPublishCensus(
            HttpServletRequest request) {
        String token = request.getHeader("token");
        String userId = TokenUtils.nothingness(token);
        if (userId == null) {
            return Result.error(405, "token不存在");
        }

        AdminUserModel user = adminUserService.getUserById(Integer.parseInt(userId));
        if (user == null) {
            return Result.error(405, "用户不存在");
        }

        List<String> xData = new ArrayList<String>();
        List<Integer> yData = new ArrayList<Integer>();

        for (int i = 0; i < 7; i++) {
            String time = DateUtil.formatDate(DateUtil.addDays(new Date(), -i));
            int count = jobPublishService.getModelCountByTime(time);
            xData.add(time);
            yData.add(count);

        }
        IndexCountVo vo = new IndexCountVo();
        vo.setXData(xData);
        vo.setYData(yData);
        return Result.success(vo);
    }


    //求职招聘
    //用人单位、在招岗位、全部岗位、求职人数、简历投递人、简历投递量
    @GetMapping("/selectEmploymentCount")
    public Result<Object> selectEmploymentCount() {
        Integer employersCount = enterpriseService.selectEmployersCount();
        Integer jobRecruitmentCount = jobPublishService.selectActivityThisMonthCount();
        Integer recruitmentCount = jobPublishService.selectRecruitmentCount();
        Integer seekersCount = customerService.selectSeekersCount();
        Integer resumeSubmitterCount = workApplyService.selectResumeSubmitterCount();
        Integer resumeSubmissionVolumeCount = workApplyService.selectResumeSubmissionVolumeCount();
        EmploymentVo vo = new EmploymentVo();
        vo.setEmployersCount(employersCount);
        vo.setJobRecruitmentCount(jobRecruitmentCount);
        vo.setRecruitmentCount(recruitmentCount);
        vo.setSeekersCount(seekersCount);
        vo.setResumeSubmitterCount(resumeSubmitterCount);
        vo.setResumeSubmissionVolumeCount(resumeSubmissionVolumeCount);
        return Result.success(vo);
    }

    //各县市
    // 用人单位、在招岗位、全部岗位、求职人数、简历投递人、简历投递量
    @GetMapping("/eachEmploymentCount")
    private Result<Object> eachEmploymentCount(Integer type) {
        List<ValueAndNameVo> vos = new ArrayList<>();
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        if (type == 1) {
            Integer ruralLaborersCount1 = vo1.getEnterpriseCount();
            Integer ruralLaborersCount2 = vo2.getEnterpriseCount();
            Integer ruralLaborersCount3 = vo3.getEnterpriseCount();
            Integer ruralLaborersCount4 = vo4.getEnterpriseCount();
            Integer ruralLaborersCount5 = vo5.getEnterpriseCount();
            Integer ruralLaborersCount6 = vo6.getEnterpriseCount();
            Integer ruralLaborersCount7 = vo7.getEnterpriseCount();
            ValueAndNameVo v1 = new ValueAndNameVo();
            v1.setName("肃州区");
            v1.setValue(ruralLaborersCount1);
            vos.add(v1);
            ValueAndNameVo v2 = new ValueAndNameVo();
            v2.setName("金塔");
            v2.setValue(ruralLaborersCount2);
            vos.add(v2);
            ValueAndNameVo v3 = new ValueAndNameVo();
            v3.setName("敦煌");
            v3.setValue(ruralLaborersCount3);
            vos.add(v3);
            ValueAndNameVo v4 = new ValueAndNameVo();
            v4.setName("瓜州");
            v4.setValue(ruralLaborersCount4);
            vos.add(v4);
            ValueAndNameVo v5 = new ValueAndNameVo();
            v5.setName("玉门");
            v5.setValue(ruralLaborersCount5);
            vos.add(v5);
            ValueAndNameVo v6 = new ValueAndNameVo();
            v6.setName("肃北");
            v6.setValue(ruralLaborersCount6);
            vos.add(v6);
            ValueAndNameVo v7 = new ValueAndNameVo();
            v7.setName("阿克塞");
            v7.setValue(ruralLaborersCount7);
            vos.add(v7);
            return Result.success(vos);
        }
        if (type == 2) {
            Integer workWillingCount1 = vo1.getJobCount();
            Integer workWillingCount2 = vo2.getJobCount();
            Integer workWillingCount3 = vo3.getJobCount();
            Integer workWillingCount4 = vo4.getJobCount();
            Integer workWillingCount5 = vo5.getJobCount();
            Integer workWillingCount6 = vo6.getJobCount();
            Integer workWillingCount7 = vo7.getJobCount();
            ValueAndNameVo v1 = new ValueAndNameVo();
            v1.setName("肃州区");
            v1.setValue(workWillingCount1);
            vos.add(v1);
            ValueAndNameVo v2 = new ValueAndNameVo();
            v2.setName("金塔");
            v2.setValue(workWillingCount2);
            vos.add(v2);
            ValueAndNameVo v3 = new ValueAndNameVo();
            v3.setName("敦煌");
            v3.setValue(workWillingCount3);
            vos.add(v3);
            ValueAndNameVo v4 = new ValueAndNameVo();
            v4.setName("瓜州");
            v4.setValue(workWillingCount4);
            vos.add(v4);
            ValueAndNameVo v5 = new ValueAndNameVo();
            v5.setName("玉门");
            v5.setValue(workWillingCount5);
            vos.add(v5);
            ValueAndNameVo v6 = new ValueAndNameVo();
            v6.setName("肃北");
            v6.setValue(workWillingCount6);
            vos.add(v6);
            ValueAndNameVo v7 = new ValueAndNameVo();
            v7.setName("阿克塞");
            v7.setValue(workWillingCount7);
            vos.add(v7);
            return Result.success(vos);
        }
        if (type == 3) {
            Integer jobCount1 = vo1.getJobCount();
            Integer jobCount2 = vo2.getJobCount();
            Integer jobCount3 = vo3.getJobCount();
            Integer jobCount4 = vo4.getJobCount();
            Integer jobCount5 = vo5.getJobCount();
            Integer jobCount6 = vo6.getJobCount();
            Integer jobCount7 = vo7.getJobCount();
            ValueAndNameVo v1 = new ValueAndNameVo();
            v1.setName("肃州区");
            v1.setValue(jobCount1);
            vos.add(v1);
            ValueAndNameVo v2 = new ValueAndNameVo();
            v2.setName("金塔");
            v2.setValue(jobCount2);
            vos.add(v2);
            ValueAndNameVo v3 = new ValueAndNameVo();
            v3.setName("敦煌");
            v3.setValue(jobCount3);
            vos.add(v3);
            ValueAndNameVo v4 = new ValueAndNameVo();
            v4.setName("瓜州");
            v4.setValue(jobCount4);
            vos.add(v4);
            ValueAndNameVo v5 = new ValueAndNameVo();
            v5.setName("玉门");
            v5.setValue(jobCount5);
            vos.add(v5);
            ValueAndNameVo v6 = new ValueAndNameVo();
            v6.setName("肃北");
            v6.setValue(jobCount6);
            vos.add(v6);
            ValueAndNameVo v7 = new ValueAndNameVo();
            v7.setName("阿克塞");
            v7.setValue(jobCount7);
            vos.add(v7);
            return Result.success(vos);
        }
        if (type == 4) {
            Integer customerCount1 = vo1.getCustomerCount();
            Integer customerCount2 = vo2.getCustomerCount();
            Integer customerCount3 = vo3.getCustomerCount();
            Integer customerCount4 = vo4.getCustomerCount();
            Integer customerCount5 = vo5.getCustomerCount();
            Integer customerCount6 = vo6.getCustomerCount();
            Integer customerCount7 = vo7.getCustomerCount();
            ValueAndNameVo v1 = new ValueAndNameVo();
            v1.setName("肃州区");
            v1.setValue(customerCount1);
            vos.add(v1);
            ValueAndNameVo v2 = new ValueAndNameVo();
            v2.setName("金塔");
            v2.setValue(customerCount2);
            vos.add(v2);
            ValueAndNameVo v3 = new ValueAndNameVo();
            v3.setName("敦煌");
            v3.setValue(customerCount3);
            vos.add(v3);
            ValueAndNameVo v4 = new ValueAndNameVo();
            v4.setName("瓜州");
            v4.setValue(customerCount4);
            vos.add(v4);
            ValueAndNameVo v5 = new ValueAndNameVo();
            v5.setName("玉门");
            v5.setValue(customerCount5);
            vos.add(v5);
            ValueAndNameVo v6 = new ValueAndNameVo();
            v6.setName("肃北");
            v6.setValue(customerCount6);
            vos.add(v6);
            ValueAndNameVo v7 = new ValueAndNameVo();
            v7.setName("阿克塞");
            v7.setValue(customerCount7);
            vos.add(v7);
            return Result.success(vos);
        }
        if (type == 5) {
            Integer delivererCount1 = vo1.getDelivererCount();
            Integer delivererCount2 = vo2.getDelivererCount();
            Integer delivererCount3 = vo3.getDelivererCount();
            Integer delivererCount4 = vo4.getDelivererCount();
            Integer delivererCount5 = vo5.getDelivererCount();
            Integer delivererCount6 = vo6.getDelivererCount();
            Integer delivererCount7 = vo7.getDelivererCount();
            ValueAndNameVo v1 = new ValueAndNameVo();
            v1.setName("肃州区");
            v1.setValue(delivererCount1);
            vos.add(v1);
            ValueAndNameVo v2 = new ValueAndNameVo();
            v2.setName("金塔");
            v2.setValue(delivererCount2);
            vos.add(v2);
            ValueAndNameVo v3 = new ValueAndNameVo();
            v3.setName("敦煌");
            v3.setValue(delivererCount3);
            vos.add(v3);
            ValueAndNameVo v4 = new ValueAndNameVo();
            v4.setName("瓜州");
            v4.setValue(delivererCount4);
            vos.add(v4);
            ValueAndNameVo v5 = new ValueAndNameVo();
            v5.setName("玉门");
            v5.setValue(delivererCount5);
            vos.add(v5);
            ValueAndNameVo v6 = new ValueAndNameVo();
            v6.setName("肃北");
            v6.setValue(delivererCount6);
            vos.add(v6);
            ValueAndNameVo v7 = new ValueAndNameVo();
            v7.setName("阿克塞");
            v7.setValue(delivererCount7);
            vos.add(v7);
            return Result.success(vos);
        }
        if (type == 6) {
            Integer delivererCount1 = vo1.getDeliveryCount();
            Integer delivererCount2 = vo2.getDeliveryCount();
            Integer delivererCount3 = vo3.getDeliveryCount();
            Integer delivererCount4 = vo4.getDeliveryCount();
            Integer delivererCount5 = vo5.getDeliveryCount();
            Integer delivererCount6 = vo6.getDeliveryCount();
            Integer delivererCount7 = vo7.getDeliveryCount();
            ValueAndNameVo v1 = new ValueAndNameVo();
            v1.setName("肃州区");
            v1.setValue(delivererCount1);
            vos.add(v1);
            ValueAndNameVo v2 = new ValueAndNameVo();
            v2.setName("金塔");
            v2.setValue(delivererCount2);
            vos.add(v2);
            ValueAndNameVo v3 = new ValueAndNameVo();
            v3.setName("敦煌");
            v3.setValue(delivererCount3);
            vos.add(v3);
            ValueAndNameVo v4 = new ValueAndNameVo();
            v4.setName("瓜州");
            v4.setValue(delivererCount4);
            vos.add(v4);
            ValueAndNameVo v5 = new ValueAndNameVo();
            v5.setName("玉门");
            v5.setValue(delivererCount5);
            vos.add(v5);
            ValueAndNameVo v6 = new ValueAndNameVo();
            v6.setName("肃北");
            v6.setValue(delivererCount6);
            vos.add(v6);
            ValueAndNameVo v7 = new ValueAndNameVo();
            v7.setName("阿克塞");
            v7.setValue(delivererCount7);
            vos.add(v7);
            return Result.success(vos);
        }
        return null;
    }

    //行业供求薪资分布 折线 平均期望薪资、平均岗位薪资
    @GetMapping("/avgSalary")
    public Result<Object> avgSalary() {
        return Result.success(jobIntentionService.avgSalary());
    }


    //动态帮扶分析
    //未就业⼈员性别、年龄分布
    @GetMapping("/employedPersonnel")
    public Result<Object> employedPersonnel() {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
//        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
//        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
//        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        Integer male = vo1.getMale() + vo2.getMale() + vo3.getMale() + vo6.getMale();
        Integer female = vo1.getFemale() + vo2.getFemale() + vo3.getFemale() + vo6.getFemale();
        double malePercent = (double) male / (male + female) * 100;
        double femalePercent = (double) female / (male + female) * 100;
        IndexCountVo vo = new IndexCountVo();
        vo.setMale(male);
        vo.setFemale(female);
        vo.setMalePercent(String.format("%.2f", malePercent));
        vo.setFemalePercent(String.format("%.2f", femalePercent));
        int[] agePercent1 = vo1.getAgePercent();
        int[] agePercent2 = vo2.getAgePercent();
        int[] agePercent3 = vo3.getAgePercent();
        int[] agePercent4 = {0, 0, 0, 0, 0, 0};
        int[] agePercent5 = {0, 0, 0, 0, 0, 0};
        int[] agePercent6 = vo6.getAgePercent();
        int[] agePercent7 = {0, 0, 0, 0, 0, 0};
        int allCount = agePercent1[5] + agePercent2[5] + agePercent3[5] + agePercent4[5] + agePercent5[5] + agePercent6[5] + agePercent7[5];
        int count1 = agePercent1[0] + agePercent2[0] + agePercent3[0] + agePercent4[0] + agePercent5[0] + agePercent6[0] + agePercent7[0];
        int count2 = agePercent1[1] + agePercent2[1] + agePercent3[1] + agePercent4[1] + agePercent5[1] + agePercent6[1] + agePercent7[1];
        int count3 = agePercent1[2] + agePercent2[2] + agePercent3[2] + agePercent4[2] + agePercent5[2] + agePercent6[2] + agePercent7[2];
        int count4 = agePercent1[3] + agePercent2[3] + agePercent3[3] + agePercent4[3] + agePercent5[3] + agePercent6[3] + agePercent7[3];
        int count5 = agePercent1[4] + agePercent2[4] + agePercent3[4] + agePercent4[4] + agePercent5[4] + agePercent6[4] + agePercent7[4];
        String format1 = String.format("%.2f", (double) count1 / allCount * 100);
        String format2 = String.format("%.2f", (double) count2 / allCount * 100);
        String format3 = String.format("%.2f", (double) count3 / allCount * 100);
        String format4 = String.format("%.2f", (double) count4 / allCount * 100);
        String format5 = String.format("%.2f", (double) count5 / allCount * 100);
        List<ValueAndNameVo> list = new ArrayList<>();
        ValueAndNameVo age1 = new ValueAndNameVo();
        age1.setName("20岁以下");
        age1.setPercent(format1);
        list.add(age1);
        ValueAndNameVo age2 = new ValueAndNameVo();
        age2.setName("20-30岁");
        age2.setPercent(format2);
        list.add(age2);
        ValueAndNameVo age3 = new ValueAndNameVo();
        age3.setName("30-40岁");
        age3.setPercent(format3);
        list.add(age3);
        ValueAndNameVo age4 = new ValueAndNameVo();
        age4.setName("40-50岁");
        age4.setPercent(format4);
        list.add(age4);
        ValueAndNameVo age5 = new ValueAndNameVo();
        age5.setName("50岁以上");
        age5.setPercent(format5);
        list.add(age5);
        vo.setAge(list);
        return Result.success(vo);
    }

    //就业意愿⼯种
    @GetMapping("/wishWork")
    public Result<Object> wishWork() {
        List<ValueAndNameVo> vo = new ArrayList<>();
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
//        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
//        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
//        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        List<QuestionnaireInvestigationModel> wishWork1 = vo1.getWishWork();
        List<QuestionnaireInvestigationModel> wishWork2 = vo2.getWishWork();
        List<QuestionnaireInvestigationModel> wishWork3 = vo3.getWishWork();
//        List<QuestionnaireInvestigationModel> wishWork4 = vo4.getWishWork();
//        List<QuestionnaireInvestigationModel> wishWork5 = vo5.getWishWork();
        List<QuestionnaireInvestigationModel> wishWork6 = vo6.getWishWork();
//        List<QuestionnaireInvestigationModel> wishWork7 = vo7.getWishWork();
        List<QuestionnaireInvestigationModel> union = (List<QuestionnaireInvestigationModel>) CollectionUtil.union(wishWork1, wishWork2, wishWork2, wishWork3, wishWork6);//, wishWork2, wishWork3, wishWork4, wishWork5, wishWork6, wishWork7
        Map<Integer, Integer> resultMap = new HashMap<>();
        for (int i1 = 0; i1 < union.size(); i1++) {
            Integer key = 0;
            if (union.get(i1).getWishWorkTypeId() != null) {
                key = union.get(i1).getWishWorkTypeId();
            }
            if (resultMap.containsKey(key)) {
                //合并
                resultMap.merge(key, resultMap.get(key), Integer::sum);
            } else {
                //存入新的值
                resultMap.put(key, union.get(i1).getCount());
            }
        }
        List<Map.Entry<Integer, Integer>> list = new ArrayList<Map.Entry<Integer, Integer>>(resultMap.entrySet()); //转换为list
        //按照Count从大到小排序
        list.sort(new Comparator<Map.Entry<Integer, Integer>>() {
            @Override
            public int compare(Map.Entry<Integer, Integer> o1, Map.Entry<Integer, Integer> o2) {
                return o2.getValue().compareTo(o1.getValue());
            }
        });
        List<Map.Entry<Integer, Integer>> collect = list.stream().limit(10).collect(Collectors.toList());
        for (
                int i = 0; i < collect.size(); i++) {
            if (collect.get(i).getKey() != null) {
                ConfigModel configModel = configMapper.selectById(collect.get(i).getKey());
                if (configModel != null) {
                    ValueAndNameVo vo0 = new ValueAndNameVo();
                    vo0.setId(i + 1);
                    vo0.setName(configModel.getName());
                    vo0.setValue(collect.get(i).getValue());
                    vo.add(vo0);
                }
            }
        }
        String[] dataY = new String[vo.size()];
        int[] dataX = new int[vo.size()];
        ValueAndNameVo valueAndNameVo = new ValueAndNameVo();
        for (int i = 0; i < vo.size(); i++) {
            dataY[i] = vo.get(i).getName();
            dataX[i] = vo.get(i).getValue();
        }
        valueAndNameVo.setDataY(dataY);
        valueAndNameVo.setDataX(dataX);
        return Result.success(valueAndNameVo);
    }

    //⾃愿培训⼯种top10
    @GetMapping("/trainWork")
    public Result<Object> trainWork() {
        List<ValueAndNameVo> vo = new ArrayList<>();
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
//        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
//        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
//        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        List<QuestionnaireInvestigationModel> wishWork1 = vo1.getTrainWork();
        List<QuestionnaireInvestigationModel> wishWork2 = vo2.getTrainWork();
        List<QuestionnaireInvestigationModel> wishWork3 = vo3.getTrainWork();
//        List<QuestionnaireInvestigationModel> wishWork4 = vo4.getTrainWork();
//        List<QuestionnaireInvestigationModel> wishWork5 = vo5.getTrainWork();
        List<QuestionnaireInvestigationModel> wishWork6 = vo6.getTrainWork();
//        List<QuestionnaireInvestigationModel> wishWork7 = vo7.getTrainWork();
        List<QuestionnaireInvestigationModel> union = (List<QuestionnaireInvestigationModel>) CollectionUtil.union(wishWork1, wishWork2, wishWork3, wishWork6);//, wishWork3, wishWork4, wishWork5, wishWork6, wishWork7
        Map<Integer, Integer> resultMap = new HashMap<>();
        for (int i1 = 0; i1 < union.size(); i1++) {
            Integer key = union.get(i1).getTrainWorkTypeId();
            if (resultMap.containsKey(key)) {
                //合并
                resultMap.merge(key, resultMap.get(key), Integer::sum);
            } else {
                //存入新的值
                resultMap.put(key, union.get(i1).getCount());
            }
        }
        List<Map.Entry<Integer, Integer>> list = new ArrayList<Map.Entry<Integer, Integer>>(resultMap.entrySet()); //转换为list//按照Count从大到小排序
        list.sort(new Comparator<Map.Entry<Integer, Integer>>() {
            @Override
            public int compare(Map.Entry<Integer, Integer> o1, Map.Entry<Integer, Integer> o2) {
                return o2.getValue().compareTo(o1.getValue());
            }
        });
        List<Map.Entry<Integer, Integer>> collect = list.stream().limit(10).collect(Collectors.toList());
        for (int i = 0; i < collect.size(); i++) {
            if (collect.get(i).getKey() != null) {
                ConfigModel configModel = configMapper.selectById(collect.get(i).getKey());
                if (configModel != null) {
                    ValueAndNameVo vo0 = new ValueAndNameVo();
                    vo0.setId(i + 1);
                    vo0.setName(configModel.getName());
                    vo0.setValue(collect.get(i).getValue());
                    vo.add(vo0);
                }
            }
        }
        String[] dataY = new String[vo.size()];
        int[] dataX = new int[vo.size()];
        ValueAndNameVo valueAndNameVo = new ValueAndNameVo();
        for (int i = 0; i < vo.size(); i++) {
            dataY[i] = vo.get(i).getName();
            dataX[i] = vo.get(i).getValue();
        }
        valueAndNameVo.setDataY(dataY);
        valueAndNameVo.setDataX(dataX);
        return Result.success(valueAndNameVo);
    }

    //⼈才情况分析
    //⼈才性别、年龄分布
    @GetMapping("/talentAgeAndSex")
    public Result<Object> talentAgeAndSex() {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouTalent");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaTalent");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangTalent");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouTalent");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenTalent");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiTalent");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiTalent");
        Integer male = vo1.getMale() + vo2.getMale() + vo3.getMale() + vo4.getMale() + vo5.getMale() + vo6.getMale() + vo7.getMale();
        Integer female = vo1.getFemale() + vo2.getFemale() + vo3.getFemale() + vo4.getFemale() + vo5.getFemale() + vo6.getFemale() + vo7.getFemale();
        double malePercent = (double) male / (male + female) * 100;
        double femalePercent = (double) female / (male + female) * 100;
        IndexCountVo vo = new IndexCountVo();
        vo.setMale(male);
        vo.setFemale(female);
        vo.setMalePercent(String.format("%.2f", malePercent));
        vo.setFemalePercent(String.format("%.2f", femalePercent));
        int[] agePercent1 = vo1.getAgePercent();
        int[] agePercent2 = vo2.getAgePercent();
        int[] agePercent3 = vo3.getAgePercent();
        int[] agePercent4 = vo4.getAgePercent();
        int[] agePercent5 = vo5.getAgePercent();
        int[] agePercent6 = vo6.getAgePercent();
        int[] agePercent7 = vo7.getAgePercent();
        int allCount = agePercent1[5] + agePercent2[5] + agePercent3[5] + agePercent4[5] + agePercent5[5] + agePercent6[5] + agePercent7[5];
        int count1 = agePercent1[0] + agePercent2[0] + agePercent3[0] + agePercent4[0] + agePercent5[0] + agePercent6[0] + agePercent7[0];
        int count2 = agePercent1[1] + agePercent2[1] + agePercent3[1] + agePercent4[1] + agePercent5[1] + agePercent6[1] + agePercent7[1];
        int count3 = agePercent1[2] + agePercent2[2] + agePercent3[2] + agePercent4[2] + agePercent5[2] + agePercent6[2] + agePercent7[2];
        int count4 = agePercent1[3] + agePercent2[3] + agePercent3[3] + agePercent4[3] + agePercent5[3] + agePercent6[3] + agePercent7[3];
        int count5 = agePercent1[4] + agePercent2[4] + agePercent3[4] + agePercent4[4] + agePercent5[4] + agePercent6[4] + agePercent7[4];
        String format1 = String.format("%.2f", (double) count1 / allCount * 100);
        String format2 = String.format("%.2f", (double) count2 / allCount * 100);
        String format3 = String.format("%.2f", (double) count3 / allCount * 100);
        String format4 = String.format("%.2f", (double) count4 / allCount * 100);
        String format5 = String.format("%.2f", (double) count5 / allCount * 100);
        List<ValueAndNameVo> list = new ArrayList<>();
        ValueAndNameVo age1 = new ValueAndNameVo();
        age1.setName("20岁以下");
        age1.setPercent(format1);
        list.add(age1);
        ValueAndNameVo age2 = new ValueAndNameVo();
        age2.setName("20-30岁");
        age2.setPercent(format2);
        list.add(age2);
        ValueAndNameVo age3 = new ValueAndNameVo();
        age3.setName("30-40岁");
        age3.setPercent(format3);
        list.add(age3);
        ValueAndNameVo age4 = new ValueAndNameVo();
        age4.setName("40-50岁");
        age4.setPercent(format4);
        list.add(age4);
        ValueAndNameVo age5 = new ValueAndNameVo();
        age5.setName("50岁以上");
        age5.setPercent(format5);
        list.add(age5);
        vo.setAge(list);
        return Result.success(vo);
    }

    //⼈才学历分布
    @GetMapping("/talentEducation")
    public Result<Object> talentEducation() {
//        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
//        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
//        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
//        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
//        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
//        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
//        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
//        ValueAndNameVo educationPercent1 = vo1.getEducationPercent();
//        ValueAndNameVo educationPercent2 = vo2.getEducationPercent();
//        ValueAndNameVo educationPercent3 = vo3.getEducationPercent();
//        ValueAndNameVo educationPercent4 = vo4.getEducationPercent();
//        ValueAndNameVo educationPercent5 = vo5.getEducationPercent();
//        ValueAndNameVo educationPercent6 = vo6.getEducationPercent();
//        ValueAndNameVo educationPercent7 = vo7.getEducationPercent();
//        
//        int[] arr2 = educationPercent2.getArr();
//        int[] arr3 = educationPercent3.getArr();
//        int[] arr4 = educationPercent4.getArr();
//        int[] arr5 = educationPercent5.getArr();
//        int[] arr6 = educationPercent6.getArr();
//        int[] arr7 = educationPercent7.getArr();
        ValueAndNameVo educationPercent1 = cusEducationService.education();
        int[] arr1 = educationPercent1.getArr();
        Map<String, Integer> resultMap = new HashMap<>();
        resultMap.put(EducationTool.EDUCATION_VO_LIST.get(0).getData(), arr1[0]);
        resultMap.put(EducationTool.EDUCATION_VO_LIST.get(1).getData(), arr1[1]);
        resultMap.put(EducationTool.EDUCATION_VO_LIST.get(2).getData(), arr1[2]);
        resultMap.put(EducationTool.EDUCATION_VO_LIST.get(3).getData(), arr1[3]);
        resultMap.put(EducationTool.EDUCATION_VO_LIST.get(4).getData(), arr1[4]);
        resultMap.put(EducationTool.EDUCATION_VO_LIST.get(5).getData(), arr1[5]);
        resultMap.put(EducationTool.EDUCATION_VO_LIST.get(6).getData(), arr1[6]);
        List<ValueAndNameVo> vos = new ArrayList<>();
        ValueAndNameVo valueAndNameVo1 = new ValueAndNameVo();
        valueAndNameVo1.setValue(arr1[0]);
        valueAndNameVo1.setName(EducationTool.EDUCATION_VO_LIST.get(0).getData() + " " + valueAndNameVo1.getValue() + "人");
        vos.add(valueAndNameVo1);
        ValueAndNameVo valueAndNameVo2 = new ValueAndNameVo();
        valueAndNameVo2.setValue(arr1[1]);
        valueAndNameVo2.setName(EducationTool.EDUCATION_VO_LIST.get(1).getData() + " " + valueAndNameVo2.getValue() + "人");
        vos.add(valueAndNameVo2);
        ValueAndNameVo valueAndNameVo3 = new ValueAndNameVo();
        valueAndNameVo3.setValue(arr1[2]);
        valueAndNameVo3.setName(EducationTool.EDUCATION_VO_LIST.get(2).getData() + " " + valueAndNameVo3.getValue() + "人");
        vos.add(valueAndNameVo3);
        ValueAndNameVo valueAndNameVo4 = new ValueAndNameVo();
        valueAndNameVo4.setValue(arr1[3]);
        valueAndNameVo4.setName(EducationTool.EDUCATION_VO_LIST.get(3).getData() + " " + valueAndNameVo4.getValue() + "人");
        vos.add(valueAndNameVo4);
        ValueAndNameVo valueAndNameVo5 = new ValueAndNameVo();
        valueAndNameVo5.setValue(arr1[4]);
        valueAndNameVo5.setName(EducationTool.EDUCATION_VO_LIST.get(4).getData() + " " + valueAndNameVo5.getValue() + "人");
        vos.add(valueAndNameVo5);
        ValueAndNameVo valueAndNameVo6 = new ValueAndNameVo();
        valueAndNameVo6.setValue(arr1[5]);
        valueAndNameVo6.setName(EducationTool.EDUCATION_VO_LIST.get(5).getData() + " " + valueAndNameVo6.getValue() + "人");
        vos.add(valueAndNameVo6);
        ValueAndNameVo valueAndNameVo7 = new ValueAndNameVo();
        valueAndNameVo7.setValue(arr1[6]);
        valueAndNameVo7.setName(EducationTool.EDUCATION_VO_LIST.get(6).getData() + " " + valueAndNameVo7.getValue() + "人");
        vos.add(valueAndNameVo7);
        return Result.success(vos);
    }

    //⼯作经验分析
    @GetMapping("/talentExperience")
    public Result<Object> talentExperience() {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        List<CusWorkExperienceModel> cusWorkExperienceModels1 = vo1.getCusWorkExperienceModels();
        List<CusWorkExperienceModel> cusWorkExperienceModels2 = vo2.getCusWorkExperienceModels();
        List<CusWorkExperienceModel> cusWorkExperienceModels3 = vo3.getCusWorkExperienceModels();
        List<CusWorkExperienceModel> cusWorkExperienceModels4 = vo4.getCusWorkExperienceModels();
        List<CusWorkExperienceModel> cusWorkExperienceModels5 = vo5.getCusWorkExperienceModels();
        List<CusWorkExperienceModel> cusWorkExperienceModels6 = vo6.getCusWorkExperienceModels();
        List<CusWorkExperienceModel> cusWorkExperienceModels7 = vo7.getCusWorkExperienceModels();
        List<CusWorkExperienceModel> cusWorkExperienceModels = (List<CusWorkExperienceModel>) CollectionUtil.union(cusWorkExperienceModels1, cusWorkExperienceModels2, cusWorkExperienceModels3, cusWorkExperienceModels4, cusWorkExperienceModels5, cusWorkExperienceModels6, cusWorkExperienceModels7);
        long count1 = cusWorkExperienceModels.stream().filter(CusWorkExperienceModel -> CusWorkExperienceModel.getExp() >= 1 && CusWorkExperienceModel.getExp() < 3).count();
        long count2 = cusWorkExperienceModels.stream().filter(CusWorkExperienceModel -> CusWorkExperienceModel.getExp() >= 3 && CusWorkExperienceModel.getExp() < 5).count();
        long count3 = cusWorkExperienceModels.stream().filter(CusWorkExperienceModel -> CusWorkExperienceModel.getExp() >= 5 && CusWorkExperienceModel.getExp() < 10).count();
        long count4 = cusWorkExperienceModels.stream().filter(CusWorkExperienceModel -> CusWorkExperienceModel.getExp() >= 10).count();
        long count = count1 + count2 + count3 + count4;
        List<ValueAndNameVo> vo = new ArrayList<>();
        ValueAndNameVo valueAndNameVo = new ValueAndNameVo();
        valueAndNameVo.setName("1-3");
        valueAndNameVo.setValue((int) count1);
        valueAndNameVo.setPercent(String.format("%.2f", (double) count1 / count * 100));
        valueAndNameVo.setId(1);
        vo.add(valueAndNameVo);
        ValueAndNameVo valueAndNameVo1 = new ValueAndNameVo();
        valueAndNameVo1.setName("3-5");
        valueAndNameVo1.setValue((int) count2);
        valueAndNameVo1.setPercent(String.format("%.2f", (double) count2 / count * 100));
        valueAndNameVo1.setId(2);
        vo.add(valueAndNameVo1);
        ValueAndNameVo valueAndNameVo2 = new ValueAndNameVo();
        valueAndNameVo2.setName("5-10");
        valueAndNameVo2.setValue((int) count3);
        valueAndNameVo2.setPercent(String.format("%.2f", (double) count3 / count * 100));
        valueAndNameVo2.setId(3);
        vo.add(valueAndNameVo2);
        ValueAndNameVo valueAndNameVo3 = new ValueAndNameVo();
        valueAndNameVo3.setName("10以上");
        valueAndNameVo3.setValue((int) count4);
        valueAndNameVo3.setPercent(String.format("%.2f", (double) count4 / count * 100));
        valueAndNameVo3.setId(4);
        vo.add(valueAndNameVo3);
        return Result.success(vo);
    }

    //⼈才求职意向⾏业分布
    @GetMapping("/talentJobIntention")
    public Result<Object> talentJobIntention() {
        List<PositionModel> parent = positionService.parent();//查父级
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouTalentJobIntention");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaTalentJobIntention");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangTalentJobIntention");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouTalentJobIntention");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenTalentJobIntention");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiTalentJobIntention");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiTalentJobIntention");
        Map<String, Integer> resultMap1 = vo1.getResultMap();
        Map<String, Integer> resultMap2 = vo2.getResultMap();
        Map<String, Integer> resultMap3 = vo3.getResultMap();
        Map<String, Integer> resultMap4 = vo4.getResultMap();
        Map<String, Integer> resultMap5 = vo5.getResultMap();
        Map<String, Integer> resultMap6 = vo6.getResultMap();
        Map<String, Integer> resultMap7 = vo7.getResultMap();
        List<ValueAndNameVo> vos = new ArrayList<>();
        for (int i = 0; i < parent.size(); i++) {
            Integer integer1 = resultMap1.get(parent.get(i).getJobTitle());
            if (integer1 == null) {
                integer1 = 0;
            }
            Integer integer2 = resultMap2.get(parent.get(i).getJobTitle());
            if (integer2 == null) {
                integer2 = 0;
            }
            Integer integer3 = resultMap3.get(parent.get(i).getJobTitle());
            if (integer3 == null) {
                integer3 = 0;
            }
            Integer integer4 = resultMap4.get(parent.get(i).getJobTitle());
            if (integer4 == null) {
                integer4 = 0;
            }
            Integer integer5 = resultMap5.get(parent.get(i).getJobTitle());
            if (integer5 == null) {
                integer5 = 0;
            }
            Integer integer6 = resultMap6.get(parent.get(i).getJobTitle());
            if (integer6 == null) {
                integer6 = 0;
            }
            Integer integer7 = resultMap7.get(parent.get(i).getJobTitle());
            if (integer7 == null) {
                integer7 = 0;
            }
            ValueAndNameVo vo = new ValueAndNameVo();
            vo.setName(parent.get(i).getJobTitle());
            vo.setValue(integer1 + integer2 + integer3 + integer4 + integer5 + integer6 + integer7);
            vos.add(vo);
        }
        String[] dataY = new String[vos.size()];
        int[] dataX = new int[vos.size()];
        ValueAndNameVo valueAndNameVo = new ValueAndNameVo();
        for (int i = 0; i < vos.size(); i++) {
            dataY[i] = vos.get(i).getName();
            if (vos.get(i).getValue() == null) {
                dataX[i] = 0;
            } else {
                dataX[i] = vos.get(i).getValue();
            }
        }
        valueAndNameVo.setDataY(dataY);
        valueAndNameVo.setDataX(dataX);
        return Result.success(valueAndNameVo);
    }

    //职业培训分析
    //各县市报名⼈数占⽐
    @GetMapping("/train")
    public Result<Object> train() {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        Integer train1 = vo1.getTrain();
        Integer train2 = vo2.getTrain();
        Integer train3 = vo3.getTrain();
        Integer train4 = vo4.getTrain();
        Integer train5 = vo5.getTrain();
        ;
        Integer train6 = vo6.getTrain();
        Integer train7 = vo7.getTrain();
        ;
        List<ValueAndNameVo> vo = new ArrayList<>();
        ValueAndNameVo valueAndNameVo1 = new ValueAndNameVo();
        valueAndNameVo1.setName("肃州区 " + train1 + "人");
        valueAndNameVo1.setValue(train1);
        vo.add(valueAndNameVo1);
        ValueAndNameVo valueAndNameVo2 = new ValueAndNameVo();
        valueAndNameVo2.setName("⽠州县 " + train2 + "人");
        valueAndNameVo2.setValue(train2);
        vo.add(valueAndNameVo2);
        ValueAndNameVo valueAndNameVo3 = new ValueAndNameVo();
        valueAndNameVo3.setName("金塔县 " + train3 + "人");
        valueAndNameVo3.setValue(train3);
        vo.add(valueAndNameVo3);
        ValueAndNameVo valueAndNameVo4 = new ValueAndNameVo();
        valueAndNameVo4.setName("玉门市 " + train4 + "人");
        valueAndNameVo4.setValue(train4);
        vo.add(valueAndNameVo4);
        ValueAndNameVo valueAndNameVo5 = new ValueAndNameVo();
        valueAndNameVo5.setName("敦煌市 " + train5 + "人");
        valueAndNameVo5.setValue(train5);
        vo.add(valueAndNameVo5);
        ValueAndNameVo valueAndNameVo6 = new ValueAndNameVo();
        valueAndNameVo6.setName("阿克塞县 " + train6 + "人");
        valueAndNameVo6.setValue(train6);
        vo.add(valueAndNameVo6);
        ValueAndNameVo valueAndNameVo7 = new ValueAndNameVo();
        valueAndNameVo7.setName("肃北县 " + train7 + "人");
        valueAndNameVo7.setValue(train7);
        vo.add(valueAndNameVo7);
        return Result.success(vo);
    }

    //培训机构数、培训课程数、工种、报名人数
    @GetMapping("/total")
    public Result<Object> total() {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        Integer train1 = vo1.getTrain();
        Integer train2 = vo2.getTrain();
        Integer train3 = vo3.getTrain();
        Integer train4 = vo4.getTrain();
        Integer train5 = vo5.getTrain();
        Integer train6 = vo6.getTrain();
        Integer train7 = vo7.getTrain();
        Integer train = train1 + train2 + train3 + train4 + train5 + train6 + train7;//报名人数
        Integer skill1 = vo1.getSkill();
        Integer skill2 = vo2.getSkill();
        Integer skill3 = vo3.getSkill();
        Integer skill4 = vo4.getSkill();
        Integer skill5 = vo5.getSkill();
        Integer skill6 = vo6.getSkill();
        Integer skill7 = vo7.getSkill();
        Integer skill = skill1 + skill2 + skill3 + skill4 + skill5 + skill6 + skill7;//培训机构数
        Integer video1 = vo1.getVideo();
        Integer video2 = vo2.getVideo();
        Integer video3 = vo3.getVideo();
        Integer video4 = vo4.getVideo();
        Integer video5 = vo5.getVideo();
        Integer video6 = vo6.getVideo();
        Integer video7 = vo7.getVideo();
        Integer video = video1 + video2 + video3 + video4 + video5 + video6 + video7;//培训课程数
        List<ValueAndNameVo> vo = new ArrayList<>();
        ValueAndNameVo valueAndNameVo1 = new ValueAndNameVo();
        valueAndNameVo1.setName("报名人数");
        valueAndNameVo1.setValue(train);
        valueAndNameVo1.setId(1);
        vo.add(valueAndNameVo1);
        ValueAndNameVo valueAndNameVo2 = new ValueAndNameVo();
        valueAndNameVo2.setName("培训机构数");
        valueAndNameVo2.setValue(skill);
        valueAndNameVo2.setId(2);
        vo.add(valueAndNameVo2);
        ValueAndNameVo valueAndNameVo3 = new ValueAndNameVo();
        valueAndNameVo3.setName("培训课程数");
        valueAndNameVo3.setValue(video);
        valueAndNameVo3.setId(3);
        vo.add(valueAndNameVo3);
        ValueAndNameVo valueAndNameVo4 = new ValueAndNameVo();
        valueAndNameVo4.setName("工种数");
        valueAndNameVo4.setValue(17);
        valueAndNameVo4.setId(4);
        vo.add(valueAndNameVo4);
        return Result.success(vo);
    }

    //各县市
    //培训机构数、培训课程数、工种、报名人数
    @GetMapping("/eachTotal")
    public Result<Object> eachTotal(Integer type) {
        List<ValueAndNameVo> vos = new ArrayList<>();
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        if (type == 1) {//报名人数
            Integer train1 = vo1.getTrain();
            Integer train2 = vo2.getTrain();
            Integer train3 = vo3.getTrain();
            Integer train4 = vo4.getTrain();
            Integer train5 = vo5.getTrain();
            Integer train6 = vo6.getTrain();
            Integer train7 = vo7.getTrain();
            ValueAndNameVo v1 = new ValueAndNameVo();
            v1.setName("肃州区");
            v1.setValue(train1);
            vos.add(v1);
            ValueAndNameVo v2 = new ValueAndNameVo();
            v2.setName("金塔");
            v2.setValue(train2);
            vos.add(v2);
            ValueAndNameVo v3 = new ValueAndNameVo();
            v3.setName("敦煌");
            v3.setValue(train3);
            vos.add(v3);
            ValueAndNameVo v4 = new ValueAndNameVo();
            v4.setName("瓜州");
            v4.setValue(train4);
            vos.add(v4);
            ValueAndNameVo v5 = new ValueAndNameVo();
            v5.setName("玉门");
            v5.setValue(train5);
            vos.add(v5);
            ValueAndNameVo v6 = new ValueAndNameVo();
            v6.setName("肃北");
            v6.setValue(train6);
            vos.add(v1);
            ValueAndNameVo v7 = new ValueAndNameVo();
            v7.setName("阿克塞");
            v7.setValue(train7);
            vos.add(v7);
            return Result.success(vos);
        }
        if (type == 2) {//培训机构数
            Integer skill1 = vo1.getSkill();
            Integer skill2 = vo2.getSkill();
            Integer skill3 = vo3.getSkill();
            Integer skill4 = vo4.getSkill();
            Integer skill5 = vo5.getSkill();
            Integer skill6 = vo6.getSkill();
            Integer skill7 = vo7.getSkill();
            ValueAndNameVo v1 = new ValueAndNameVo();
            v1.setName("肃州区");
            v1.setValue(skill1);
            vos.add(v1);
            ValueAndNameVo v2 = new ValueAndNameVo();
            v2.setName("金塔");
            v2.setValue(skill2);
            vos.add(v2);
            ValueAndNameVo v3 = new ValueAndNameVo();
            v3.setName("敦煌");
            v3.setValue(skill3);
            vos.add(v3);
            ValueAndNameVo v4 = new ValueAndNameVo();
            v4.setName("瓜州");
            v4.setValue(skill4);
            vos.add(v4);
            ValueAndNameVo v5 = new ValueAndNameVo();
            v5.setName("玉门");
            v5.setValue(skill5);
            vos.add(v5);
            ValueAndNameVo v6 = new ValueAndNameVo();
            v6.setName("肃北");
            v6.setValue(skill6);
            vos.add(v1);
            ValueAndNameVo v7 = new ValueAndNameVo();
            v7.setName("阿克塞");
            v7.setValue(skill7);
            vos.add(v7);
            return Result.success(vos);
        }
        if (type == 3) {//培训课程数
            Integer video1 = vo1.getVideo();
            Integer video2 = vo2.getVideo();
            Integer video3 = vo3.getVideo();
            Integer video4 = vo4.getVideo();
            Integer video5 = vo5.getVideo();
            Integer video6 = vo6.getVideo();
            Integer video7 = vo7.getVideo();
            ValueAndNameVo v1 = new ValueAndNameVo();
            v1.setName("肃州区");
            v1.setValue(video1);
            vos.add(v1);
            ValueAndNameVo v2 = new ValueAndNameVo();
            v2.setName("金塔");
            v2.setValue(video2);
            vos.add(v2);
            ValueAndNameVo v3 = new ValueAndNameVo();
            v3.setName("敦煌");
            v3.setValue(video3);
            vos.add(v3);
            ValueAndNameVo v4 = new ValueAndNameVo();
            v4.setName("瓜州");
            v4.setValue(video4);
            vos.add(v4);
            ValueAndNameVo v5 = new ValueAndNameVo();
            v5.setName("玉门");
            v5.setValue(video5);
            vos.add(v5);
            ValueAndNameVo v6 = new ValueAndNameVo();
            v6.setName("肃北");
            v6.setValue(video6);
            vos.add(v1);
            ValueAndNameVo v7 = new ValueAndNameVo();
            v7.setName("阿克塞");
            v7.setValue(video7);
            vos.add(v7);
            return Result.success(vos);
        }
        if (type == 4) {//培训课程数
            ValueAndNameVo v1 = new ValueAndNameVo();
            v1.setName("肃州区");
            v1.setValue(58);
            vos.add(v1);
            ValueAndNameVo v2 = new ValueAndNameVo();
            v2.setName("金塔");
            v2.setValue(41);
            vos.add(v2);
            ValueAndNameVo v3 = new ValueAndNameVo();
            v3.setName("敦煌");
            v3.setValue(33);
            vos.add(v3);
            ValueAndNameVo v4 = new ValueAndNameVo();
            v4.setName("瓜州");
            v4.setValue(37);
            vos.add(v4);
            ValueAndNameVo v5 = new ValueAndNameVo();
            v5.setName("玉门");
            v5.setValue(25);
            vos.add(v5);
            ValueAndNameVo v6 = new ValueAndNameVo();
            v6.setName("肃北");
            v6.setValue(23);
            vos.add(v1);
            ValueAndNameVo v7 = new ValueAndNameVo();
            v7.setName("阿克塞");
            v7.setValue(18);
            vos.add(v7);
            return Result.success(vos);
        }
        return null;
    }

    //地图
    @GetMapping("/tranMap")
    public Result<Object> tranMap(Integer type) {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        if (type == 1) {
            Integer train1 = vo1.getTrain();
            Integer skill1 = vo1.getSkill();
            Integer video1 = vo1.getVideo();
            ValueAndNameVo valueAndNameVo1 = new ValueAndNameVo();
            valueAndNameVo1.setTrain(train1);
            valueAndNameVo1.setSkill(skill1);
            valueAndNameVo1.setVideo(video1);
            valueAndNameVo1.setWorkType(58);
            return Result.success(valueAndNameVo1);
        }
        if (type == 2) {
            Integer train1 = vo2.getTrain();
            Integer skill1 = vo2.getSkill();
            Integer video1 = vo2.getVideo();
            ValueAndNameVo valueAndNameVo1 = new ValueAndNameVo();
            valueAndNameVo1.setTrain(train1);
            valueAndNameVo1.setSkill(skill1);
            valueAndNameVo1.setVideo(video1);
            valueAndNameVo1.setWorkType(41);
            return Result.success(valueAndNameVo1);
        }
        if (type == 3) {
            Integer train1 = vo3.getTrain();
            Integer skill1 = vo3.getSkill();
            Integer video1 = vo3.getVideo();
            ValueAndNameVo valueAndNameVo1 = new ValueAndNameVo();
            valueAndNameVo1.setTrain(train1);
            valueAndNameVo1.setSkill(skill1);
            valueAndNameVo1.setVideo(video1);
            valueAndNameVo1.setWorkType(33);
            return Result.success(valueAndNameVo1);
        }
        if (type == 4) {
            Integer train1 = vo4.getTrain();
            Integer skill1 = vo4.getSkill();
            Integer video1 = vo4.getVideo();
            ValueAndNameVo valueAndNameVo1 = new ValueAndNameVo();
            valueAndNameVo1.setTrain(train1);
            valueAndNameVo1.setSkill(skill1);
            valueAndNameVo1.setVideo(video1);
            valueAndNameVo1.setWorkType(37);
            return Result.success(valueAndNameVo1);
        }
        if (type == 5) {
            Integer train1 = vo5.getTrain();
            Integer skill1 = vo5.getSkill();
            Integer video1 = vo5.getVideo();
            ValueAndNameVo valueAndNameVo1 = new ValueAndNameVo();
            valueAndNameVo1.setTrain(train1);
            valueAndNameVo1.setSkill(skill1);
            valueAndNameVo1.setVideo(video1);
            valueAndNameVo1.setWorkType(25);
            return Result.success(valueAndNameVo1);
        }
        if (type == 6) {
            Integer train1 = vo6.getTrain();
            Integer skill1 = vo6.getSkill();
            Integer video1 = vo6.getVideo();
            ValueAndNameVo valueAndNameVo1 = new ValueAndNameVo();
            valueAndNameVo1.setTrain(train1);
            valueAndNameVo1.setSkill(skill1);
            valueAndNameVo1.setVideo(video1);
            valueAndNameVo1.setWorkType(23);
            return Result.success(valueAndNameVo1);
        }
        if (type == 7) {
            Integer train1 = vo7.getTrain();
            Integer skill1 = vo7.getSkill();
            Integer video1 = vo7.getVideo();
            ValueAndNameVo valueAndNameVo1 = new ValueAndNameVo();
            valueAndNameVo1.setTrain(train1);
            valueAndNameVo1.setSkill(skill1);
            valueAndNameVo1.setVideo(video1);
            valueAndNameVo1.setWorkType(18);
            return Result.success(valueAndNameVo1);
        }
        return null;
    }

    /**
     * 就业态势
     *
     * @return
     */
    //农村劳动力就业分布占比
    @GetMapping("/ruralWorkers")
    private Result<Object> ruralWorkers() {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        //在家务农
        Integer agriculture1 = vo1.getAgriculture();
        Integer agriculture2 = vo2.getAgriculture();
        Integer agriculture3 = vo3.getAgriculture();
        Integer agriculture4 = 0;
        Integer agriculture5 = 0;
        Integer agriculture6 = vo6.getAgriculture();
        Integer agriculture7 = 0;
        //外出务工
        Integer industry1 = vo1.getIndustry();
        Integer industry2 = vo2.getIndustry();
        Integer industry3 = vo3.getIndustry();
        Integer industry4 = 0;
        Integer industry5 = 0;
        Integer industry6 = vo6.getIndustry();
        Integer industry7 = 0;
        Integer agriculture = agriculture1 + agriculture2 + agriculture3 + agriculture4 + agriculture5 + agriculture6 + agriculture7;
        Integer industry = industry1 + industry2 + industry3 + industry4 + industry5 + industry6 + industry7;
        List<ValueAndNameVo> vos = new ArrayList<>();
        ValueAndNameVo v1 = new ValueAndNameVo();
        v1.setName("在家务农：" + String.format("%.2f", (double) agriculture / (agriculture + industry) * 100) + "% " + agriculture + " 人");
        v1.setValue(agriculture);
        vos.add(v1);
        ValueAndNameVo v2 = new ValueAndNameVo();
        v2.setName("外出务工：" + String.format("%.2f", (double) industry / (agriculture + industry) * 100) + "% " + industry + " 人");
        v2.setValue(industry);
        vos.add(v2);
        return Result.success(vos);
    }

    //重点人群就业分布
    @GetMapping("/keynoteCount")
    private Result<Object> keynoteCount() {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        //残疾人
        Integer deformedMan1 = vo1.getDeformedMan();
        Integer deformedMan3 = vo3.getDeformedMan();
        Integer deformedMan6 = vo6.getDeformedMan();
        Integer deformedMan = deformedMan1 + deformedMan3 + deformedMan6;
        //退伍军人
        Integer veteran1 = vo1.getVeteran();
        Integer veteran3 = vo3.getVeteran();
        Integer veteran6 = vo6.getVeteran();
        Integer veteran = veteran1 + veteran3 + veteran6;
        //搞笑毕业生
        Integer collegeGraduates1 = vo1.getCollegeGraduates();
        Integer collegeGraduates3 = vo3.getCollegeGraduates();
        Integer collegeGraduates6 = vo6.getCollegeGraduates();
        Integer collegeGraduates = collegeGraduates1 + collegeGraduates3 + collegeGraduates6;
        List<ValueAndNameVo> vos = new ArrayList<>();
        ValueAndNameVo v1 = new ValueAndNameVo();
        v1.setName("残疾人：" + String.format("%.2f", (double) deformedMan / (deformedMan + veteran + collegeGraduates) * 100) + "% " + deformedMan + " 人");
        v1.setValue(deformedMan);
        vos.add(v1);
        ValueAndNameVo v2 = new ValueAndNameVo();
        v2.setName("退伍军人：" + String.format("%.2f", (double) veteran / (deformedMan + veteran + collegeGraduates) * 100) + "% " + veteran + " 人");
        v2.setValue(veteran);
        vos.add(v2);
        ValueAndNameVo v3 = new ValueAndNameVo();
        v3.setName("高校毕业生：" + String.format("%.2f", (double) collegeGraduates / (deformedMan + veteran + collegeGraduates) * 100) + "% " + collegeGraduates + " 人");
        v3.setValue(collegeGraduates);
        vos.add(v3);
        return Result.success(vos);
    }

    //重点人群就业分布列表
    @GetMapping("/keynoteList")
    private Result<Object> keynoteList(Integer type) {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        List<KeyNoteVo> voList = new ArrayList<>();
        if (type == 1) {
            //残疾人
            Integer deformedMan1 = vo1.getDeformedMan();
            Integer deformedMan2 = vo2.getDeformedMan();
            Integer deformedMan3 = vo3.getDeformedMan();
            Integer deformedMan6 = vo6.getDeformedMan();
            KeyNoteVo vo = new KeyNoteVo();
            vo.setName("肃州区");
            vo.setValue(deformedMan1);
            voList.add(vo);
            KeyNoteVo voJt = new KeyNoteVo();
            voJt.setName("金塔县");
            voJt.setValue(deformedMan2);
            voList.add(voJt);
            KeyNoteVo voDh = new KeyNoteVo();
            voDh.setName("敦煌市");
            voDh.setValue(deformedMan3);
            voList.add(voDh);
            KeyNoteVo voSb = new KeyNoteVo();
            voSb.setName("肃北县");
            voSb.setValue(deformedMan6);
            voList.add(voSb);
        } else if (type == 2) {
            //退伍军人
            Integer veteran1 = vo1.getVeteran();
            Integer veteran2 = vo2.getVeteran();
            Integer veteran3 = vo3.getVeteran();
            Integer veteran6 = vo6.getVeteran();
            KeyNoteVo vo = new KeyNoteVo();
            vo.setName("肃州区");
            vo.setValue(veteran1);
            voList.add(vo);
            KeyNoteVo voJt = new KeyNoteVo();
            voJt.setName("金塔县");
            voJt.setValue(veteran2);
            voList.add(voJt);
            KeyNoteVo voDh = new KeyNoteVo();
            voDh.setName("敦煌市");
            voDh.setValue(veteran3);
            voList.add(voDh);
            KeyNoteVo voSb = new KeyNoteVo();
            voSb.setName("肃北县");
            voSb.setValue(veteran6);
            voList.add(voSb);
        } else if (type == 3) {
            //搞笑毕业生
            Integer collegeGraduates1 = vo1.getCollegeGraduates();
            Integer collegeGraduates2 = vo2.getCollegeGraduates();
            Integer collegeGraduates3 = vo3.getCollegeGraduates();
            Integer collegeGraduates6 = vo6.getCollegeGraduates();
            KeyNoteVo vo = new KeyNoteVo();
            vo.setName("肃州区");
            vo.setValue(collegeGraduates1);
            voList.add(vo);
            KeyNoteVo voJt = new KeyNoteVo();
            voJt.setName("金塔县");
            voJt.setValue(collegeGraduates2);
            voList.add(voJt);
            KeyNoteVo voDh = new KeyNoteVo();
            voDh.setName("敦煌市");
            voDh.setValue(collegeGraduates3);
            voList.add(voDh);
            KeyNoteVo voSb = new KeyNoteVo();
            voSb.setName("肃北县");
            voSb.setValue(collegeGraduates6);
            voList.add(voSb);
        }

        return Result.success(voList);
    }


    //各县市农村劳动力，城镇有就业意愿人数、全市城镇未就业人数、城镇就业率
    @GetMapping("/eachRuralAndCityCount")
    private Result<Object> eachRuralAndCityCount(Integer type) {
        List<ValueAndNameVo> vos = new ArrayList<>();
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        if (type == 1) {
            Integer ruralLaborersCount1 = vo1.getRuralLaborersCount();
            Integer ruralLaborersCount2 = vo2.getRuralLaborersCount();
            Integer ruralLaborersCount3 = vo3.getRuralLaborersCount();
            Integer ruralLaborersCount4 = vo4.getRuralLaborersCount();
            Integer ruralLaborersCount5 = vo5.getRuralLaborersCount();
            Integer ruralLaborersCount6 = vo6.getRuralLaborersCount();
            Integer ruralLaborersCount7 = vo7.getRuralLaborersCount();
            ValueAndNameVo v1 = new ValueAndNameVo();
            v1.setId(1);
            v1.setName("肃州区");
            v1.setValue(ruralLaborersCount1);
            vos.add(v1);
            ValueAndNameVo v2 = new ValueAndNameVo();
            v2.setId(2);
            v2.setName("金塔");
            v2.setValue(ruralLaborersCount2);
            vos.add(v2);
            ValueAndNameVo v3 = new ValueAndNameVo();
            v3.setId(3);
            v3.setName("敦煌");
            v3.setValue(ruralLaborersCount3);
            vos.add(v3);
            ValueAndNameVo v4 = new ValueAndNameVo();
            v4.setId(4);
            v4.setName("瓜州");
            v4.setValue(ruralLaborersCount4);
            vos.add(v4);
            ValueAndNameVo v5 = new ValueAndNameVo();
            v5.setId(5);
            v5.setName("玉门");
            v5.setValue(ruralLaborersCount5);
            vos.add(v5);
            ValueAndNameVo v6 = new ValueAndNameVo();
            v6.setId(6);
            v6.setName("肃北");
            v6.setValue(ruralLaborersCount6);
            vos.add(v6);
            ValueAndNameVo v7 = new ValueAndNameVo();
            v7.setId(7);
            v7.setName("阿克塞");
            v7.setValue(ruralLaborersCount7);
            vos.add(v7);
            return Result.success(vos);
        }
        if (type == 2) {
            Integer workWillingCount1 = vo1.getWorkWillingCount();
            Integer workWillingCount2 = vo2.getWorkWillingCount();
            Integer workWillingCount3 = vo3.getWorkWillingCount();
            Integer workWillingCount4 = vo4.getWorkWillingCount();
            Integer workWillingCount5 = vo5.getWorkWillingCount();
            Integer workWillingCount6 = vo6.getWorkWillingCount();
            Integer workWillingCount7 = vo7.getWorkWillingCount();
            ValueAndNameVo v1 = new ValueAndNameVo();
            v1.setId(1);
            v1.setName("肃州区");
            v1.setValue(workWillingCount1);
            vos.add(v1);
            ValueAndNameVo v2 = new ValueAndNameVo();
            v2.setId(2);
            v2.setName("金塔");
            v2.setValue(workWillingCount2);
            vos.add(v2);
            ValueAndNameVo v3 = new ValueAndNameVo();
            v3.setId(3);
            v3.setName("敦煌");
            v3.setValue(workWillingCount3);
            vos.add(v3);
            ValueAndNameVo v4 = new ValueAndNameVo();
            v4.setId(4);
            v4.setName("瓜州");
            v4.setValue(workWillingCount4);
            vos.add(v4);
            ValueAndNameVo v5 = new ValueAndNameVo();
            v5.setId(5);
            v5.setName("玉门");
            v5.setValue(workWillingCount5);
            vos.add(v5);
            ValueAndNameVo v6 = new ValueAndNameVo();
            v6.setId(6);
            v6.setName("肃北");
            v6.setValue(workWillingCount6);
            vos.add(v6);
            ValueAndNameVo v7 = new ValueAndNameVo();
            v7.setId(7);
            v7.setName("阿克塞");
            v7.setValue(workWillingCount7);
            vos.add(v7);
            return Result.success(vos);
        }
        if (type == 3) {
            Integer cityNoWorkCount1 = vo1.getCityNoWorkCount();
            Integer cityNoWorkCount2 = vo2.getCityNoWorkCount();
            Integer cityNoWorkCount3 = vo3.getCityNoWorkCount();
            Integer cityNoWorkCount4 = vo4.getCityNoWorkCount();
            Integer cityNoWorkCount5 = vo5.getCityNoWorkCount();
            Integer cityNoWorkCount6 = vo6.getCityNoWorkCount();
            Integer cityNoWorkCount7 = vo7.getCityNoWorkCount();
            ValueAndNameVo v1 = new ValueAndNameVo();
            v1.setId(1);
            v1.setName("肃州区");
            v1.setValue(cityNoWorkCount1);
            vos.add(v1);
            ValueAndNameVo v2 = new ValueAndNameVo();
            v2.setId(2);
            v2.setName("金塔");
            v2.setValue(cityNoWorkCount2);
            vos.add(v2);
            ValueAndNameVo v3 = new ValueAndNameVo();
            v3.setId(3);
            v3.setName("敦煌");
            v3.setValue(cityNoWorkCount3);
            vos.add(v3);
            ValueAndNameVo v4 = new ValueAndNameVo();
            v4.setId(4);
            v4.setName("瓜州");
            v4.setValue(cityNoWorkCount4);
            vos.add(v4);
            ValueAndNameVo v5 = new ValueAndNameVo();
            v5.setId(5);
            v5.setName("玉门");
            v5.setValue(cityNoWorkCount5);
            vos.add(v5);
            ValueAndNameVo v6 = new ValueAndNameVo();
            v6.setId(6);
            v6.setName("肃北");
            v6.setValue(cityNoWorkCount6);
            vos.add(v6);
            ValueAndNameVo v7 = new ValueAndNameVo();
            v7.setId(7);
            v7.setName("阿克塞");
            v7.setValue(cityNoWorkCount7);
            vos.add(v7);
            return Result.success(vos);
        }
        if (type == 4) {
            Integer cityNoWorkCount1 = vo1.getCityNoWorkCount();
            Integer cityNoWorkCount2 = vo2.getCityNoWorkCount();
            Integer cityNoWorkCount3 = vo3.getCityNoWorkCount();
            Integer cityNoWorkCount4 = vo4.getCityNoWorkCount();
            Integer cityNoWorkCount5 = vo5.getCityNoWorkCount();
            Integer cityNoWorkCount6 = vo6.getCityNoWorkCount();
            Integer cityNoWorkCount7 = vo7.getCityNoWorkCount();
            Integer cityCount1 = vo1.getCityCount();
            Integer cityCount2 = vo2.getCityCount();
            Integer cityCount3 = vo3.getCityCount();
            Integer cityCount4 = 0;
            Integer cityCount5 = 0;
            Integer cityCount6 = vo6.getCityCount();
            Integer cityCount7 = 0;
            ValueAndNameVo v1 = new ValueAndNameVo();
            v1.setId(1);
            String rate = String.format("%.2f", (double) (cityCount1 - cityNoWorkCount1) / cityCount1 * 100);
            v1.setName("肃州区");
            v1.setPercent(rate);
            vos.add(v1);
            ValueAndNameVo v2 = new ValueAndNameVo();
            v2.setId(2);
            String rate2 = String.format("%.2f", (double) (cityCount2 - cityNoWorkCount2) / cityCount2 * 100);
            v2.setName("金塔");
            v2.setPercent(rate2);
            vos.add(v2);
            ValueAndNameVo v3 = new ValueAndNameVo();
            v3.setId(3);
            String rate3 = String.format("%.2f", (double) (cityCount3 - cityNoWorkCount3) / cityCount3 * 100);
            v3.setName("敦煌");
            v3.setPercent(rate3);
            vos.add(v3);
            ValueAndNameVo v4 = new ValueAndNameVo();
            v4.setId(4);
//            String rate4 = String.format("%.2f", (double) (cityCount4 - cityNoWorkCount4) / cityCount4 * 100);
            v4.setName("瓜州");
            v4.setPercent("0");
            vos.add(v4);
            ValueAndNameVo v5 = new ValueAndNameVo();
            v5.setId(5);
//            String rate5 = String.format("%.2f", (double) (cityCount5 - cityNoWorkCount5) / cityCount5 * 100);
            v5.setName("玉门");
            v5.setPercent("0");
            vos.add(v5);
            ValueAndNameVo v6 = new ValueAndNameVo();
            v6.setId(6);
            String rate6 = String.format("%.2f", (double) (cityCount6 - cityNoWorkCount6) / cityCount6 * 100);
            v6.setName("肃北");
            v6.setPercent(rate6);
            vos.add(v6);
            ValueAndNameVo v7 = new ValueAndNameVo();
            v7.setId(7);
//            String rate7 = String.format("%.2f", (double) (cityCount7 - cityNoWorkCount7) / cityCount7 * 100);
            v7.setName("阿克塞");
            v7.setPercent("0");
            vos.add(v7);
            return Result.success(vos);
        }
        return null;
    }

    //就业态势地图
    @GetMapping("/employmentMap")
    private Result<Object> employmentMap(Integer type) {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        if (type == 1) {
            Integer ruralLaborersCount1 = vo1.getRuralLaborersCount();
            Integer workWillingCount1 = vo1.getWorkWillingCount();
            Integer cityNoWorkCount1 = vo1.getCityNoWorkCount();
            Integer cityCount1 = vo1.getCityCount();
            String rate = String.format("%.2f", (double) (cityCount1 - cityNoWorkCount1) / cityCount1 * 100);
            ValueAndNameVo vo = new ValueAndNameVo();
            vo.setRuralLaborersCount(ruralLaborersCount1);
            vo.setWorkWillingCount(workWillingCount1);
            vo.setCityNoWorkCount(cityNoWorkCount1);
            vo.setRate(rate);
            return Result.success(vo);
        }
        if (type == 2) {
            Integer ruralLaborersCount2 = vo2.getRuralLaborersCount();
            Integer workWillingCount2 = vo2.getWorkWillingCount();
            Integer cityNoWorkCount2 = vo2.getCityNoWorkCount();
            Integer cityCount2 = vo2.getCityCount();
            String rate = String.format("%.2f", (double) (cityCount2 - cityNoWorkCount2) / cityCount2 * 100);
            ValueAndNameVo vo = new ValueAndNameVo();
            vo.setRuralLaborersCount(ruralLaborersCount2);
            vo.setWorkWillingCount(workWillingCount2);
            vo.setCityNoWorkCount(cityNoWorkCount2);
            vo.setRate(rate);
            return Result.success(vo);
        }
        if (type == 3) {
            Integer ruralLaborersCount3 = vo3.getRuralLaborersCount();
            Integer workWillingCount3 = vo3.getWorkWillingCount();
            Integer cityNoWorkCount3 = vo3.getCityNoWorkCount();
            Integer cityCount3 = vo3.getCityCount();
            String rate = String.format("%.2f", (double) (cityCount3 - cityNoWorkCount3) / cityCount3 * 100);
            ValueAndNameVo vo = new ValueAndNameVo();
            vo.setRuralLaborersCount(ruralLaborersCount3);
            vo.setWorkWillingCount(workWillingCount3);
            vo.setCityNoWorkCount(cityNoWorkCount3);
            vo.setRate(rate);
            return Result.success(vo);
        }
        if (type == 4) {
//            Integer ruralLaborersCount4 = vo4.getRuralLaborersCount();
//            Integer workWillingCount4 = vo4.getWorkWillingCount();
//            Integer cityNoWorkCount4 = vo4.getCityNoWorkCount();
//            Integer cityCount4 = vo4.getCityCount();
//            String rate = String.format("%.2f", (double) (cityCount4 - cityNoWorkCount4) / cityCount4 * 100);
            Integer ruralLaborersCount4 = 0;
            Integer workWillingCount4 = 0;
            Integer cityNoWorkCount4 = 0;
            Integer cityCount4 = 0;
//            String rate = String.format("%.2f", (double) (cityCount4 - cityNoWorkCount4) / cityCount4 * 100);
            ValueAndNameVo vo = new ValueAndNameVo();
            vo.setRuralLaborersCount(ruralLaborersCount4);
            vo.setWorkWillingCount(workWillingCount4);
            vo.setCityNoWorkCount(cityNoWorkCount4);
            vo.setRate("0");
            return Result.success(vo);
        }
        if (type == 5) {
//            Integer ruralLaborersCount5 = vo5.getRuralLaborersCount();
//            Integer workWillingCount5 = vo5.getWorkWillingCount();
//            Integer cityNoWorkCount5 = vo5.getCityNoWorkCount();
//            Integer cityCount5 = vo5.getCityCount();
            Integer ruralLaborersCount5 = 0;
            Integer workWillingCount5 = 0;
            Integer cityNoWorkCount5 = 0;
            Integer cityCount5 = 0;
//            String rate = String.format("%.2f", (double) (cityCount5 - cityNoWorkCount5) / cityCount5 * 100);
            ValueAndNameVo vo = new ValueAndNameVo();
            vo.setRuralLaborersCount(ruralLaborersCount5);
            vo.setWorkWillingCount(workWillingCount5);
            vo.setCityNoWorkCount(cityNoWorkCount5);
            vo.setRate("0");
            return Result.success(vo);
        }
        if (type == 6) {
            Integer ruralLaborersCount6 = vo6.getRuralLaborersCount();
            Integer workWillingCount6 = vo6.getWorkWillingCount();
            Integer cityNoWorkCount6 = vo6.getCityNoWorkCount();
            Integer cityCount6 = vo6.getCityCount();
            String rate = String.format("%.2f", (double) (cityCount6 - cityNoWorkCount6) / cityCount6 * 100);
            ValueAndNameVo vo = new ValueAndNameVo();
            vo.setRuralLaborersCount(ruralLaborersCount6);
            vo.setWorkWillingCount(workWillingCount6);
            vo.setCityNoWorkCount(cityNoWorkCount6);
            vo.setRate(rate);
            return Result.success(vo);
        }
        if (type == 7) {
//            Integer ruralLaborersCount7 = vo7.getRuralLaborersCount();
//            Integer workWillingCount7 = vo7.getWorkWillingCount();
//            Integer cityNoWorkCount7 = vo7.getCityNoWorkCount();
//            Integer cityCount7 = vo7.getCityCount();
            Integer ruralLaborersCount7 = 0;
            Integer workWillingCount7 = 0;
            Integer cityNoWorkCount7 = 0;
            Integer cityCount7 = 0;
//            String rate = String.format("%.2f", (double) (cityCount7 - cityNoWorkCount7) / cityCount7 * 100);
            ValueAndNameVo vo = new ValueAndNameVo();
            vo.setRuralLaborersCount(ruralLaborersCount7);
            vo.setWorkWillingCount(workWillingCount7);
            vo.setCityNoWorkCount(cityNoWorkCount7);
            vo.setRate("0");
            return Result.success(vo);
        }
        return null;
    }

    //未就业人员意向就业岗位(TOP20)
    @GetMapping("/unemployedPost")
    public Result unemployedPost() {
        List<QuestionnaireInvestigationModel> unemployedPost = questionnaireInvestigationService.unemployedPost();
        return Result.success(unemployedPost);
    }


    //4、产业用工情况：服务业、农业、制造业


    //供求行业分组
    @GetMapping("/supplyAndDemandIndustries")
    public Result<Object> supplyAndDemandIndustries() {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        //行业需求数
        List<JobPublishModel> industryDemands = new ArrayList<>();
        List<JobPublishModel> industryDemand1 = vo1.getIndustryDemand();
        List<JobPublishModel> industryDemand2 = vo2.getIndustryDemand();
        List<JobPublishModel> industryDemand3 = vo3.getIndustryDemand();
        List<JobPublishModel> industryDemand4 = vo4.getIndustryDemand();
        List<JobPublishModel> industryDemand5 = vo5.getIndustryDemand();
        List<JobPublishModel> industryDemand6 = vo6.getIndustryDemand();
        List<JobPublishModel> industryDemand7 = vo7.getIndustryDemand();
        industryDemands.addAll(industryDemand1);
        industryDemands.addAll(industryDemand2);
        industryDemands.addAll(industryDemand3);
        industryDemands.addAll(industryDemand4);
        industryDemands.addAll(industryDemand5);
        industryDemands.addAll(industryDemand6);
        industryDemands.addAll(industryDemand7);
        //行业供给数
        List<JobIntentionModel> industrySupplyList = new ArrayList<>();
        List<JobIntentionModel> industrySupply1 = vo1.getIndustrySupply();
        List<JobIntentionModel> industrySupply2 = vo2.getIndustrySupply();
        List<JobIntentionModel> industrySupply3 = vo3.getIndustrySupply();
        List<JobIntentionModel> industrySupply4 = vo4.getIndustrySupply();
        List<JobIntentionModel> industrySupply5 = vo5.getIndustrySupply();
        List<JobIntentionModel> industrySupply6 = vo6.getIndustrySupply();
        List<JobIntentionModel> industrySupply7 = vo7.getIndustrySupply();
        industrySupplyList.addAll(industrySupply1);
        industrySupplyList.addAll(industrySupply2);
        industrySupplyList.addAll(industrySupply3);
        industrySupplyList.addAll(industrySupply4);
        industrySupplyList.addAll(industrySupply5);
        industrySupplyList.addAll(industrySupply6);
        industrySupplyList.addAll(industrySupply7);
        QueryWrapper<PositionModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("level", 1);
        List<PositionModel> positionModels = positionMapper.selectList(queryWrapper);
        String[] strings = new String[positionModels.size()];
        int[] arr = new int[positionModels.size()];
        int[] arr2 = new int[positionModels.size()];
        for (int i = 0; i < positionModels.size(); i++) {
            strings[i] = positionModels.get(i).getJobTitle();
            for (int i1 = 0; i1 < industryDemands.size(); i1++) {
                if (positionModels.get(i).getId() == industryDemands.get(i1).getId()) {
                    arr[i] = industryDemands.get(i1).getSumAll() * 3;
                }
            }
            for (int i1 = 0; i1 < industrySupplyList.size(); i1++) {
                if (positionModels.get(i).getId() == industrySupplyList.get(i1).getId()) {
                    arr2[i] = industrySupplyList.get(i1).getSumAll() * 3;
                }
            }
        }
        List<Integer> arrList = new ArrayList<>();
        List<Integer> arr2List = new ArrayList<>();
        List<String> stringsList = new ArrayList<>();
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] > 0) {
                arrList.add(arr[i]);
                arr2List.add(arr2[i]);
                stringsList.add(strings[i]);
            }
        }
        String[] newStrings = new String[arrList.size()];
        int[] newArr = new int[arrList.size()];
        int[] newArr2 = new int[arrList.size()];
        for (int i = 0; i < arrList.size(); i++) {
            newStrings[i] = stringsList.get(i);
            newArr[i] = arrList.get(i);
            newArr2[i] = arr2List.get(i);
        }
        ValueAndNameVo vo = new ValueAndNameVo();
        vo.setStrings(newStrings);
        vo.setArr(newArr);
        vo.setArr2(newArr2);
        return Result.success(vo);
    }


    @GetMapping("/getRegistrationRatio")
    private Result<Object> getRegistrationRatio() {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");

        if (vo1 == null) {
            vo1 = new IndexCountVo();

        }
        if (vo2 == null) {
            vo2 = new IndexCountVo();
        }
        if (vo3 == null) {
            vo3 = new IndexCountVo();
        }
        if (vo4 == null) {
            vo4 = new IndexCountVo();
        }
        if (vo5 == null) {
            vo5 = new IndexCountVo();
        }
        if (vo6 == null) {
            vo6 = new IndexCountVo();
        }
        if (vo7 == null) {
            vo7 = new IndexCountVo();
        }


        List<Integer> comList = new ArrayList<>();
        comList.add(vo1.getEnterpriseCount());
        comList.add(vo2.getEnterpriseCount());
        comList.add(vo3.getEnterpriseCount());
        comList.add(vo4.getEnterpriseCount());
        comList.add(vo5.getEnterpriseCount());
        comList.add(vo6.getEnterpriseCount());
        comList.add(vo7.getEnterpriseCount());
        List<Integer> cusList = new ArrayList<>();
        cusList.add(vo1.getCustomerCount());
        cusList.add(vo2.getCustomerCount());
        cusList.add(vo3.getCustomerCount());
        cusList.add(vo4.getCustomerCount());
        cusList.add(vo5.getCustomerCount());
        cusList.add(vo6.getCustomerCount());
        cusList.add(vo7.getCustomerCount());
        List<ExportVo> voList = new ArrayList<>();
        List<Integer> cusZongList = new ArrayList<>();
        List<Integer> comZongList = new ArrayList<>();
        cusZongList.add(232863);
        cusZongList.add(63233);
        cusZongList.add(76712);
        cusZongList.add(59319);
        cusZongList.add(52318);
        cusZongList.add(7131);
        cusZongList.add(5606);
        comZongList.add(3409);
        comZongList.add(689);
        comZongList.add(1160);
        comZongList.add(497);
        comZongList.add(666);
        comZongList.add(184);
        comZongList.add(212);
        for (int i = 1; i < 8; i++) {
            ExportVo v1 = new ExportVo();
            double cusRatio = Math.round(cusList.get(i - 1) * 100 / cusZongList.get(i - 1)) / 100.0;//人数占比
            double comRatio = Math.round(comList.get(i - 1) * 100 / comZongList.get(i - 1)) / 100.0;//企业占比
            if (i == 1) {
                v1.setAreaName("肃州区");
            } else if (i == 2) {
                v1.setAreaName("金塔县");
            } else if (i == 3) {
                v1.setAreaName("敦煌市");
            } else if (i == 4) {
                v1.setAreaName("瓜州县");
            } else if (i == 5) {
                v1.setAreaName("玉门市");
            } else if (i == 6) {
                v1.setAreaName("肃北县");
            } else {
                v1.setAreaName("阿克塞县");
            }

            if (cusRatio >= 1) {
                cusRatio = 1;
            }
            if (comRatio >= 1) {
                comRatio = 1;
            }
            v1.setZhucerenshuzhanbi(cusRatio * 100 + "%");
            v1.setZhuceqiyezhanbi(comRatio * 100 + "%");
            v1.setZongfen(String.valueOf((cusRatio * 50) + (comRatio * 50)));
            voList.add(v1);
        }
        //根据总分排序
        Collections.sort(voList, new Comparator<ExportVo>() {
            @Override
            public int compare(ExportVo p1, ExportVo p2) {
                return Double.compare(Double.valueOf(p2.getZongfen()), Double.valueOf(p1.getZongfen()));
            }
        });
        return Result.success(voList);
    }

    //导出 4526137
    @GetMapping("/export")
    @ResponseBody
    public void export(HttpServletRequest request, HttpServletResponse response) {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        Integer enterpriseCount1 = vo1.getEnterpriseCount();
        Integer enterpriseCount2 = vo2.getEnterpriseCount();
        Integer enterpriseCount3 = vo3.getEnterpriseCount();
        Integer enterpriseCount4 = vo4.getEnterpriseCount();
        Integer enterpriseCount5 = vo5.getEnterpriseCount();
        Integer enterpriseCount6 = vo6.getEnterpriseCount();
        Integer enterpriseCount7 = vo7.getEnterpriseCount();

        Integer customerCount1 = vo1.getCustomerCount();
        Integer customerCount2 = vo2.getCustomerCount();
        Integer customerCount3 = vo3.getCustomerCount();
        Integer customerCount4 = vo4.getCustomerCount();
        Integer customerCount5 = vo5.getCustomerCount();
        Integer customerCount6 = vo6.getCustomerCount();
        Integer customerCount7 = vo7.getCustomerCount();
        List<ExportVo> list = new ArrayList<>();
        ExportVo v1 = new ExportVo();

        v1.setEnterpriseCount(enterpriseCount1);
        v1.setCustomerCount((double) customerCount1 / 10000);
        v1.setZhuceqiyezhanbi(String.format("%.4f", (double) (enterpriseCount1 / 3409 * 100)) + "%");
        v1.setZhucerenshuzhanbi(String.format("%.4f", (double) (customerCount1 / 10000 / 1.701 * 100)) + "%");
        v1.setZongfen((String.format("%.4f", (double) (enterpriseCount1 / 3409 * 100 * 50 + customerCount1 / 10000 / 1.701 * 100 * 50))));

        ExportVo v2 = new ExportVo();
        v2.setEnterpriseCount(enterpriseCount2);
        v2.setCustomerCount((double) customerCount2 / 10000);
        v2.setZhuceqiyezhanbi(String.format("%.4f", (double) (enterpriseCount2 / 184 * 100)) + "%");
        v2.setZhucerenshuzhanbi(String.format("%.4f", (double) (customerCount2 / 10000 / 1.51 * 100)) + "%");
        v2.setZongfen((String.format("%.4f", (double) (enterpriseCount2 / 184 * 100 * 50 + customerCount2 / 10000 / 1.51 * 100 * 50))));

        ExportVo v3 = new ExportVo();
        v3.setEnterpriseCount(enterpriseCount3);
        v3.setCustomerCount((double) customerCount3 / 10000);
        v3.setZhuceqiyezhanbi(String.format("%.4f", (double) (enterpriseCount3 / 689 * 100)) + "%");
        v3.setZhucerenshuzhanbi(String.format("%.4f", (double) (customerCount3 / 10000 / 12.18 * 100)) + "%");
        v3.setZongfen((String.format("%.4f", (double) (enterpriseCount3 / 689 * 100 * 50 + customerCount3 / 10000 / 12.18 * 100 * 50))));

        ExportVo v4 = new ExportVo();
        v4.setEnterpriseCount(enterpriseCount4);
        v4.setCustomerCount((double) customerCount4 / 10000);
        v4.setZhuceqiyezhanbi(String.format("%.4f", (double) (enterpriseCount4 / 497 * 100)) + "%");
        v4.setZhucerenshuzhanbi(String.format("%.4f", (double) (customerCount4 / 10000 / 12.93 * 100)) + "%");
        v4.setZongfen((String.format("%.4f", (double) (enterpriseCount4 / 497 * 100 * 50 + customerCount4 / 10000 / 1.51 / 12.93 * 100 * 50))));


        ExportVo v5 = new ExportVo();
        v5.setEnterpriseCount(enterpriseCount5);
        v5.setCustomerCount((double) customerCount5 / 10000);
        v5.setZhuceqiyezhanbi(String.format("%.4f", (double) (enterpriseCount5 / 666 * 100)) + "%");
        v5.setZhucerenshuzhanbi(String.format("%.4f", (double) (customerCount5 / 10000 / 13.77 * 100)) + "%");
        v5.setZongfen((String.format("%.4f", (double) (enterpriseCount5 / 666 * 100 * 50 + customerCount5 / 10000 / 13.77 * 100 * 50))));

        ExportVo v6 = new ExportVo();
        v6.setEnterpriseCount(enterpriseCount6);
        v6.setCustomerCount((double) customerCount6 / 10000);
        v6.setZhuceqiyezhanbi(String.format("%.4f", (double) (enterpriseCount6 / 689 * 100)) + "%");
        v6.setZhucerenshuzhanbi(String.format("%.4f", (double) (customerCount6 / 10000 / 12.18 * 100)) + "%");
        v6.setZongfen((String.format("%.4f", (double) (enterpriseCount6 / 689 * 100 * 50 + customerCount6 / 10000 / 12.18 * 100 * 50))));

        ExportVo v7 = new ExportVo();
        v7.setEnterpriseCount(enterpriseCount7);
        v7.setCustomerCount((double) customerCount7 / 10000);
        v7.setZhuceqiyezhanbi(String.format("%.4f", (double) (enterpriseCount7 / 212 * 100)) + "%");
        v7.setZhucerenshuzhanbi(String.format("%.4f", (double) (customerCount7 / 10000 / 1.1 * 100)) + "%");
        v7.setZongfen((String.format("%.4f", (double) (enterpriseCount7 / 212 * 100 * 50 + customerCount7 / 10000 / 1.1 * 100 * 50))));

        list.add(v4);
        list.add(v5);
        list.add(v2);
        list.add(v6);
        list.add(v1);
        list.add(v3);
        list.add(v7);
        String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"));
        Map<String, Object> map = Maps.newHashMap();
        map.put("list", list);
        map.put("time", time);
        map.put("eAll", enterpriseCount1 + enterpriseCount2 + enterpriseCount3 + enterpriseCount4 + enterpriseCount5 + enterpriseCount6 + enterpriseCount7);
        map.put("cAll", (customerCount1 + customerCount2 + customerCount3 + customerCount4 + customerCount5 + customerCount6 + customerCount7) / 10000);
        map.put("qAll", v1.getZhuceqiyezhanbi() + v2.getZhuceqiyezhanbi() + v3.getZhuceqiyezhanbi() + v7.getZhuceqiyezhanbi() + v6.getZhuceqiyezhanbi() + v5.getZhuceqiyezhanbi() + v4.getZhuceqiyezhanbi());
        map.put("rAll", v1.getZhucerenshuzhanbi() + v2.getZhucerenshuzhanbi() + v3.getZhucerenshuzhanbi() + v4.getZhucerenshuzhanbi() + v5.getZhucerenshuzhanbi() + v6.getZhucerenshuzhanbi() + v7.getZhucerenshuzhanbi());
//        map.put("zAll", (map.get("qAll")) * 50 + (map.get("rAll")) * 50);
        String fileName = "酒泉市“码上就业”公共服务平台推广应用情况统计表";
        try {
            TemplateExportParams params = new TemplateExportParams("/home/jiuye/upload/mashangjiuye1.xlsx", true);
            exportExcel(params, map, fileName, response);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void exportExcel(TemplateExportParams params, Map<String, Object> map, String fileName, HttpServletResponse response) throws IOException {

        Workbook workbook = ExcelExportUtil.exportExcel(params, map);
        downLoadExcel(fileName, response, workbook);
    }

    private static void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) {
        try {
            response.setContentType("application/vnd.ms-excel");
            response.setHeader("Content-disposition", "attachment; filename=" + java.net.URLEncoder.encode(fileName + ".xlsx", "UTF-8"));
            ServletOutputStream outStream = null;
            try {
                outStream = response.getOutputStream();
                workbook.write(outStream);

            } finally {
                outStream.flush();
                outStream.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    //各模块点击量
    //统计点击量存入redis
    @GetMapping("/clickCount")
    public Result<Object> clickCount() {//type = 1 招聘求职 type = 2 零工超市
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        int recruitCount1 = vo1.getRecruitCount();
        int recruitCount2 = vo2.getRecruitCount();
        int recruitCount3 = vo3.getRecruitCount();
        int recruitCount4 = vo4.getRecruitCount();
        int recruitCount5 = vo5.getRecruitCount();
        int recruitCount6 = vo6.getRecruitCount();
        int recruitCount7 = vo7.getRecruitCount();
        int oddJobCount1 = vo1.getOddJobCount();
        int oddJobCount2 = vo2.getOddJobCount();
        int oddJobCount3 = vo3.getOddJobCount();
        int oddJobCount4 = vo4.getOddJobCount();
        int oddJobCount5 = vo5.getOddJobCount();
        int oddJobCount6 = vo6.getOddJobCount();
        int oddJobCount7 = vo7.getOddJobCount();
        IndexCountVo vo = new IndexCountVo();
        vo.setRecruitCount(recruitCount1 + recruitCount2 + recruitCount3 + recruitCount4 + recruitCount5 + recruitCount6 + recruitCount7);
        vo.setOddJobCount(oddJobCount1 + oddJobCount2 + oddJobCount3 + oddJobCount4 + oddJobCount5 + oddJobCount6 + oddJobCount7);
        return Result.success(vo);
    }

    @GetMapping("/clickStatistics")
    public Result<Object> clickStatistics(Integer type) {//type = 1pc2小程序3触摸屏
        ClickStatisticsModel clickStatisticsModel = new ClickStatisticsModel();
        if (type != null && type == 1) {
            clickStatisticsModel.setType(type);
        }
        if (type != null && type == 2) {
            clickStatisticsModel.setType(type);
        }
        if (type != null && type == 3) {
            clickStatisticsModel.setType(type);
        }
        clickStatisticsModel.setCrtTime(CommonHelp.getNowTimestamp());
        clickStatisticsMapper.insert(clickStatisticsModel);
        return Result.success("记录成功");
    }

    //各县市访问量趋势
    @GetMapping("/selectTrendOfVisits")
    public Result<Object> selectTrendOfVisits() {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        List<Integer> map1 = vo1.getTrendOfVisits();
        List<Integer> map2 = vo2.getTrendOfVisits();
        List<Integer> map3 = vo3.getTrendOfVisits();
        List<Integer> map4 = vo4.getTrendOfVisits();
        List<Integer> map5 = vo5.getTrendOfVisits();
        List<Integer> map6 = vo6.getTrendOfVisits();
        List<Integer> map7 = vo7.getTrendOfVisits();
        List<List<Integer>> list = new ArrayList<>();
        list.add(map1);
        list.add(map2);
        list.add(map3);
        list.add(map4);
        list.add(map5);
        list.add(map6);
        list.add(map7);
        return Result.success(list);
    }

    /**
     * 帮扶情况
     *
     * @return
     */
    @GetMapping("/getHelpSituation")
    public Result<Object> getHelpSituation() {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        List<UnemploymentSituationVo> list = new ArrayList<>();
        list.add(vo1.getUnemploymentSituationVo());
        list.add(vo2.getUnemploymentSituationVo());
        list.add(vo3.getUnemploymentSituationVo());
        list.add(vo4.getUnemploymentSituationVo());
        list.add(vo5.getUnemploymentSituationVo());
        list.add(vo6.getUnemploymentSituationVo());
        list.add(vo7.getUnemploymentSituationVo());
        return Result.success(list);
    }

    /**
     * 帮扶情况
     *
     * @return
     */
    @GetMapping("/getHandleSituation")
    public Result<Object> getHandleSituation() {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        List<UnemploymentSituationVo> list = new ArrayList<>();
        list.add(vo1.getHandleVo());
        list.add(vo2.getHandleVo());
        list.add(vo3.getHandleVo());
        list.add(vo4.getHandleVo());
        list.add(vo5.getHandleVo());
        list.add(vo6.getHandleVo());
        list.add(vo7.getHandleVo());
        return Result.success(list);
    }

    //各县市帮扶就业人员情况
    @GetMapping("/personnelSituation")
    public Result<Object> personnelSituation() {
        IndexCountVo vo1 = (IndexCountVo) redisService.getStringKey("suzhouIndexCount");
        IndexCountVo vo2 = (IndexCountVo) redisService.getStringKey("jintaIndexCount");
        IndexCountVo vo3 = (IndexCountVo) redisService.getStringKey("dunhuangIndexCount");
        IndexCountVo vo4 = (IndexCountVo) redisService.getStringKey("guazhouIndexCount");
        IndexCountVo vo5 = (IndexCountVo) redisService.getStringKey("yumenIndexCount");
        IndexCountVo vo6 = (IndexCountVo) redisService.getStringKey("subeiIndexCount");
        IndexCountVo vo7 = (IndexCountVo) redisService.getStringKey("akesaiIndexCount");
        List<Integer[]> list = new ArrayList<>();
        Integer[] integers = {vo1.getWxCount()[1] * 10, vo1.getWxCount()[0] * 10, vo1.getWxCount()[2] * 10};
        Integer[] integers1 = {vo2.getWxCount()[1] * 10, vo2.getWxCount()[0] * 10, vo2.getWxCount()[2] * 10};
        Integer[] integers2 = {vo4.getWxCount()[1] * 10, vo4.getWxCount()[0] * 10, vo4.getWxCount()[2] * 10};
        Integer[] integers3 = {vo5.getWxCount()[1] * 10, vo5.getWxCount()[0] * 10, vo5.getWxCount()[2] * 10};
        Integer[] integers4 = {vo3.getWxCount()[1] * 10, vo3.getWxCount()[0] * 10, vo3.getWxCount()[2] * 10};
        Integer[] integers5 = {vo6.getWxCount()[1] * 10, vo6.getWxCount()[0] * 10, vo6.getWxCount()[2] * 10};
        Integer[] integers6 = {vo7.getWxCount()[1] * 10, vo7.getWxCount()[0] * 10, vo7.getWxCount()[2] * 10};
        list.add(integers);
        list.add(integers1);
        list.add(integers2);
        list.add(integers3);
        list.add(integers4);
        list.add(integers5);
        list.add(integers6);
        return Result.success(list);
    }


}
